Skip to content

Conversation

@PurplePolyhedron
Copy link
Contributor

@PurplePolyhedron PurplePolyhedron commented Jul 26, 2024

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 DropdownMenu search 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 DropdownMenu other 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.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jul 26, 2024
@nate-thegrate nate-thegrate self-requested a review July 27, 2024 01:28
@PurplePolyhedron PurplePolyhedron marked this pull request as ready for review July 28, 2024 16:56
@PurplePolyhedron PurplePolyhedron marked this pull request as draft July 28, 2024 21:37
@PurplePolyhedron PurplePolyhedron marked this pull request as ready for review July 29, 2024 10:34
Copy link
Contributor

@nate-thegrate nate-thegrate left a 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 :)

Copy link
Contributor

@QuncCccccc QuncCccccc left a 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;
}
Copy link
Contributor

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.

Copy link
Contributor Author

@PurplePolyhedron PurplePolyhedron Aug 8, 2024

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.

@QuncCccccc QuncCccccc self-requested a review August 14, 2024 23:55
@PurplePolyhedron PurplePolyhedron force-pushed the dropdown_menu_keyboard_navigation branch from c7aa174 to 080928d Compare August 16, 2024 17:11
@PurplePolyhedron
Copy link
Contributor Author

PurplePolyhedron commented Aug 16, 2024

Reopening because I closed it by mistake when solving merge conflict

Copy link
Contributor

@QuncCccccc QuncCccccc left a 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:)

auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 21, 2024
flutter/flutter@e7da16d...b8f89f7

2024-08-21 34465683+rkishan516@users.noreply.github.com docs: Update doc for scale behaviour of floating label (flutter/flutter#151835)
2024-08-21 120297255+PurplePolyhedron@users.noreply.github.com Disable Dropdown menu search during keyboard navigation (flutter/flutter#152378)
2024-08-21 matanlurey@users.noreply.github.com Add a `bin/flutter-dev` script, for running the `flutter` command-line tool from source (flutter/flutter#153599)
2024-08-21 engine-flutter-autoroll@skia.org Roll Packages from 4d2d2e3 to 4e5d47e (6 revisions) (flutter/flutter#153848)
2024-08-21 jason-simmons@users.noreply.github.com Remove unnecessary breaks in default clauses of switch statements (flutter/flutter#153843)
2024-08-21 reidbaker@google.com Create Postmortem-Platform-View-android-14-regression (flutter/flutter#149201)
2024-08-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#153838)
2024-08-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#153833)
2024-08-21 32538273+ValentinVignal@users.noreply.github.com Add tests for `SingleChildScrollView` examples (flutter/flutter#153548)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from b1220aa0ebf2 to b94e0097035d (3 revisions) (flutter/flutter#153817)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from aa1422391cf6 to b1220aa0ebf2 (1 revision) (flutter/flutter#153810)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from a6508d6557dc to aa1422391cf6 (2 revisions) (flutter/flutter#153808)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5cbf96d0a80f to a6508d6557dc (1 revision) (flutter/flutter#153806)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3d18f65c378a to 5cbf96d0a80f (3 revisions) (flutter/flutter#153804)
2024-08-21 nate.w5687@gmail.com `_InteractiveViewerState` code cleanup (flutter/flutter#153645)
2024-08-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from b80c831e03f7 to 3d18f65c378a (1 revision) (flutter/flutter#153797)
2024-08-20 polinach@google.com Fix leaky test. (flutter/flutter#153798)
2024-08-20 polinach@google.com Fix leaky tests. (flutter/flutter#153786)
2024-08-20 engine-flutter-autoroll@skia.org 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 34871572+gmackall@users.noreply.github.com Update template/test `compileSdk`, `targetSdk`, `ndk` versions (flutter/flutter#152487)
2024-08-20 42016383+DBowen33@users.noreply.github.com add autofocus to fix a11y issue with dialog (flutter/flutter#152637)
2024-08-20 kevinjchisholm@google.com [Release] Update bots to expect new entitlements (flutter/flutter#153787)
2024-08-20 engine-flutter-autoroll@skia.org Roll Flutter Engine from d6bc4dc6e59d to 663176175b4c (1 revision) (flutter/flutter#153785)
2024-08-20 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#153740)
2024-08-20 victorsanniay@gmail.com Implement tap to scroll to item in CupertinoPicker (flutter/flutter#153386)
2024-08-20 polinach@google.com Fix leaky test. (flutter/flutter#153780)
2024-08-20 engine-flutter-autoroll@skia.org 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 dit@google.com,rmistry@google.com,stuartmorgan@google.com 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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
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.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

3 participants