-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Disable Dropdown menu search during keyboard navigation #152378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable Dropdown menu search during keyboard navigation #152378
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
I made an optional suggestion; feel free to take a look and implement it if you'd like :)
QuncCccccc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the contribution! Just left one question.
| } | ||
| if (currentHighlight != null && entries[currentHighlight!].label.toLowerCase().contains(searchText)) { | ||
| return currentHighlight; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, why do we remove this block of code? I remember this part is added to fix the keyboard navigation: #147294.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#147294 only works on the default search, so the bug still exist when a custom search callback is provided. I used another method to fix the issue which doesn't rely on the search function, and this code is no longer needed.
The main reason for reverting #147294 was to keep default search consistent with searchCallback where it doesn't have direct access to currentHighlight. And since we don't know the match condition of a custom searchCallback, we cannot implement "prioritising current selection" for a searchCallback, the only way to keep it consistent is to remove the feature. Also I think the original intent of search is to be agnostic about the state of DropdownMenu.
However prioritising current selection is a bit more intuitive, and now #147294 has landed in stable, I am no longer sure removing the feature is correct, since it also affect the behaviour the highlight while searching.
update: I now lean towards keeping the search untouched. Since #151878 is a somewhat common issue, and fixing the range error itself(PR #151969) is a lot safer to Cherry pick. While this PR should go through the regular process. I can revert back to removing this block if you think it is more suitable.
c7aa174 to
080928d
Compare
|
Reopening because I closed it by mistake when solving merge conflict |
QuncCccccc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the fix:)
flutter/flutter@e7da16d...b8f89f7 2024-08-21 [email protected] docs: Update doc for scale behaviour of floating label (flutter/flutter#151835) 2024-08-21 [email protected] Disable Dropdown menu search during keyboard navigation (flutter/flutter#152378) 2024-08-21 [email protected] Add a `bin/flutter-dev` script, for running the `flutter` command-line tool from source (flutter/flutter#153599) 2024-08-21 [email protected] Roll Packages from 4d2d2e3 to 4e5d47e (6 revisions) (flutter/flutter#153848) 2024-08-21 [email protected] Remove unnecessary breaks in default clauses of switch statements (flutter/flutter#153843) 2024-08-21 [email protected] Create Postmortem-Platform-View-android-14-regression (flutter/flutter#149201) 2024-08-21 [email protected] Roll pub packages (flutter/flutter#153838) 2024-08-21 [email protected] Roll pub packages (flutter/flutter#153833) 2024-08-21 [email protected] Add tests for `SingleChildScrollView` examples (flutter/flutter#153548) 2024-08-21 [email protected] Roll Flutter Engine from b1220aa0ebf2 to b94e0097035d (3 revisions) (flutter/flutter#153817) 2024-08-21 [email protected] Roll Flutter Engine from aa1422391cf6 to b1220aa0ebf2 (1 revision) (flutter/flutter#153810) 2024-08-21 [email protected] Roll Flutter Engine from a6508d6557dc to aa1422391cf6 (2 revisions) (flutter/flutter#153808) 2024-08-21 [email protected] Roll Flutter Engine from 5cbf96d0a80f to a6508d6557dc (1 revision) (flutter/flutter#153806) 2024-08-21 [email protected] Roll Flutter Engine from 3d18f65c378a to 5cbf96d0a80f (3 revisions) (flutter/flutter#153804) 2024-08-21 [email protected] `_InteractiveViewerState` code cleanup (flutter/flutter#153645) 2024-08-20 [email protected] Roll Flutter Engine from b80c831e03f7 to 3d18f65c378a (1 revision) (flutter/flutter#153797) 2024-08-20 [email protected] Fix leaky test. (flutter/flutter#153798) 2024-08-20 [email protected] Fix leaky tests. (flutter/flutter#153786) 2024-08-20 [email protected] Roll Flutter Engine from 663176175b4c to b80c831e03f7 (1 revision) (flutter/flutter#153789) 2024-08-20 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Update template/test `compileSdk`, `targetSdk`, `ndk` versions (#152487)" (flutter/flutter#153793) 2024-08-20 [email protected] Update template/test `compileSdk`, `targetSdk`, `ndk` versions (flutter/flutter#152487) 2024-08-20 [email protected] add autofocus to fix a11y issue with dialog (flutter/flutter#152637) 2024-08-20 [email protected] [Release] Update bots to expect new entitlements (flutter/flutter#153787) 2024-08-20 [email protected] Roll Flutter Engine from d6bc4dc6e59d to 663176175b4c (1 revision) (flutter/flutter#153785) 2024-08-20 [email protected] Roll pub packages (flutter/flutter#153740) 2024-08-20 [email protected] Implement tap to scroll to item in CupertinoPicker (flutter/flutter#153386) 2024-08-20 [email protected] Fix leaky test. (flutter/flutter#153780) 2024-08-20 [email protected] Roll Flutter Engine from e10b07598091 to d6bc4dc6e59d (2 revisions) (flutter/flutter#153781) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
fixes flutter#152375 PR flutter#147294 fix keyboard navigation issue flutter#147253 by prioritising current selection in default search. This revert PR flutter#147294 and fix the issue by disabling `DropdownMenu` search during keyboard navigation instead. also fixes flutter#151878 as it is a regression caused by PR flutter#147294. Reason for reverting flutter#147294 : it doesn't fix the keyboard navigation issue if a custom searchCallback(Issue flutter#152375) is provided, and "prioritising current selection" is ambiguous for a custom searchCallback, so it would be tricky to have searchCallback behave the same way as the default search. Additionally the original search function was agnostic about the state of `DropdownMenu` other than the entry value type, might be good to keep it that way unless needed.
fixes #152375
PR #147294 fix keyboard navigation issue #147253 by prioritising current selection in default search.
This revert PR #147294 and fix the issue by disabling
DropdownMenusearch during keyboard navigation instead.also fixes #151878 as it is a regression caused by PR #147294.
Reason for reverting #147294 : it doesn't fix the keyboard navigation issue if a custom searchCallback(Issue #152375) is provided, and "prioritising current selection" is ambiguous for a custom searchCallback, so it would be tricky to have searchCallback behave the same way as the default search. Additionally the original search function was agnostic about the state of
DropdownMenuother than the entry value type, might be good to keep it that way unless needed.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.