Fix keyboard navigation for date token in filtered search

What does this MR do and why?

Fixes keyboard navigation issues with the date filter token in the filtered search bar, as described in #420266.

  • Handle Tab key to submit the selected date before the token deactivates (previously pressing Tab would make the token disappear without saving)
  • Fix Backspace clearing the date input causing the date to reappear (previously clearing the date with backspace would cause it to magically reappear)
  • Add unit tests for both keyboard navigation behaviors

How to set up and validate locally

  1. Enable the feature flag in Rails console:

    Copy to clipboard

    Copy to clipboard

    Insert at cursor

    Insert at cursor

    Feature.enable(:issue_date_filter)

  2. Visit any issues list page e.g. http://127.0.0.1:3000/dashboard/issues

  3. Click the search/filter bar and select Created date

  4. Select on or after operator

  5. Pick a date using the mouse

  6. Press Tab — the token should stay and submit the date

  7. Add another date token, pick a date, press Backspace to clear — the date should stay cleared

References

Merge request reports

Loading