-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[material/menu_anchor.dart] MenuAnchor focus refactoring for RawMenuAnchor #150950
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
[material/menu_anchor.dart] MenuAnchor focus refactoring for RawMenuAnchor #150950
Conversation
| node: _menuScopeNode, | ||
| skipTraversal: !isOpen, | ||
| canRequestFocus: isOpen, | ||
| descendantsAreFocusable: true, |
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.
I think this is the default anyhow. It's not explicitly the default, since it's nullable, but it works out that way. Does setting this actually make a difference?
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.
Surprisingly, it did make a difference on my master branch. The menus can be traversed multiple times test fails when omitted, but I haven't explored why this is.
[✓] Flutter (Channel master, 3.24.0-1.0.pre.127, on macOS 14.0 23A344 darwin-arm64, locale en-US)
• Flutter version 3.24.0-1.0.pre.127 on channel master at /Users/davidhicks/fvm/versions/master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fbb12c2c61 (3 hours ago), 2024-07-15 18:34:38 -0400
• Engine revision f1363fb7c2
• Dart version 3.6.0 (build 3.6.0-36.0.dev)
• DevTools version 2.37.1There 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.
Well, that is odd. I guess there must be an edge case in there somewhere.
Co-authored-by: Greg Spencer <[email protected]>
Co-authored-by: Greg Spencer <[email protected]>
gspencergoog
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.
dkwingsmt
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
Manual roll requested by [email protected] flutter/flutter@1dd7141...0a7f8af 2024-08-06 [email protected] Support clearing selection programmatically through SelectableRegionState (flutter/flutter#152882) 2024-08-06 [email protected] Roll Flutter Engine from aabd582e9c7e to 206e86ee8a40 (4 revisions) (flutter/flutter#152962) 2024-08-06 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 4.3.4 to 4.3.6 (flutter/flutter#152964) 2024-08-06 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.15 to 3.26.0 (flutter/flutter#152965) 2024-08-06 [email protected] [tool] Guard process writes to frontend server in `ResidentCompiler` (flutter/flutter#152358) 2024-08-06 [email protected] Fix Linux_android_emu tests late initialization errors (flutter/flutter#152932) 2024-08-06 [email protected] Marks Mac integration_ui_test_test_macos to be flaky (flutter/flutter#152213) 2024-08-06 [email protected] Roll pub packages (flutter/flutter#152956) 2024-08-06 [email protected] [API Examples] `scroll_direction.0_test.dart` & `growth_direction.0_test.dart` (flutter/flutter#152941) 2024-08-06 [email protected] [devicelab] opt gallery benchmarks and platform view test into merged thread mode. (flutter/flutter#152940) 2024-08-06 [email protected] Roll Flutter Engine from e97955bf12ac to aabd582e9c7e (1 revision) (flutter/flutter#152948) 2024-08-06 [email protected] Roll pub packages (flutter/flutter#152945) 2024-08-06 [email protected] [material/menu_anchor.dart] MenuAnchor focus refactoring for RawMenuAnchor (flutter/flutter#150950) 2024-08-06 [email protected] Roll Flutter Engine from 99da2cab3f6d to e97955bf12ac (2 revisions) (flutter/flutter#152944) 2024-08-06 [email protected] fix: add parameter to maintainState of SearchDelegate (flutter/flutter#152444) 2024-08-06 [email protected] Feat: Add fillColor property for cupertinoCheckbox (flutter/flutter#151761) 2024-08-06 [email protected] Slider does not show changed label value for keyboard users fix (flutter/flutter#152886) 2024-08-06 [email protected] Add Nate Wilson to authors (flutter/flutter#152907) 2024-08-06 [email protected] Roll Flutter Engine from 7fc38bef4775 to 99da2cab3f6d (1 revision) (flutter/flutter#152934) 2024-08-06 [email protected] Roll Packages from 82e8d1e to 551bde5 (12 revisions) (flutter/flutter#152930) 2024-08-06 [email protected] Roll Flutter Engine from 84116159ebfc to 7fc38bef4775 (1 revision) (flutter/flutter#152924) 2024-08-06 [email protected] Roll Flutter Engine from f75ffb65cfe3 to 84116159ebfc (1 revision) (flutter/flutter#152917) 2024-08-06 [email protected] Roll Flutter Engine from f5f6e966e7e7 to f75ffb65cfe3 (2 revisions) (flutter/flutter#152915) 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
…nchor (flutter#150950) This PR is aimed at (1) reducing the private API surface of _MenuAnchorState to make migration into RawMenuAnchor simpler, and (2) fixing focus-related bugs. Directional focus handling was moved from MenuAnchor (_MenuDirectionalFocusAction, _MenuNextFocusAction, and _MenuPreviousFocusAction) into SubmenuButton (_SubmenuDirectionalFocusAction). MenuAnchor now behaves similarly to a flat FocusScope, which makes it easier to customize. A future PR will ideally expose or remove the remaining internals (_lastItemFocusNode, _firstItemFocusNode, _isRoot, etc). All previous framework tests are passing, and additional tests were added for fixes (MenuAnchor tab traversal, reopened menus not being focusable), and to test MenuAnchor focus behavior separately from MenuBar. However, [one example test](https://github.com/flutter/flutter/pull/150950/files#diff-a33fa01b59d280784e7c8ed6b704bd005cde95b7d3b649dc82fd58530061a09d) had to be changed. I'm not sure why the previous example test was working to begin with, as submenu buttons are supposed to open on focus, but this behavior was not observed in the original test. Fixes flutter#144381, flutter#150334. One added feature is the ability to move between top-level horizontal submenus if a horizontal movement is made on a vertical menu item that has no children in the movement direction. This behavior was observed on Google Docs, MacOS, and various other menu systems I encountered. https://github.com/flutter/flutter/assets/59215665/04a42b8a-cc9e-4a50-9d0c-6f2d784cfc78
…nchor (flutter#150950) This PR is aimed at (1) reducing the private API surface of _MenuAnchorState to make migration into RawMenuAnchor simpler, and (2) fixing focus-related bugs. Directional focus handling was moved from MenuAnchor (_MenuDirectionalFocusAction, _MenuNextFocusAction, and _MenuPreviousFocusAction) into SubmenuButton (_SubmenuDirectionalFocusAction). MenuAnchor now behaves similarly to a flat FocusScope, which makes it easier to customize. A future PR will ideally expose or remove the remaining internals (_lastItemFocusNode, _firstItemFocusNode, _isRoot, etc). All previous framework tests are passing, and additional tests were added for fixes (MenuAnchor tab traversal, reopened menus not being focusable), and to test MenuAnchor focus behavior separately from MenuBar. However, [one example test](https://github.com/flutter/flutter/pull/150950/files#diff-a33fa01b59d280784e7c8ed6b704bd005cde95b7d3b649dc82fd58530061a09d) had to be changed. I'm not sure why the previous example test was working to begin with, as submenu buttons are supposed to open on focus, but this behavior was not observed in the original test. Fixes flutter#144381, flutter#150334. One added feature is the ability to move between top-level horizontal submenus if a horizontal movement is made on a vertical menu item that has no children in the movement direction. This behavior was observed on Google Docs, MacOS, and various other menu systems I encountered. https://github.com/flutter/flutter/assets/59215665/04a42b8a-cc9e-4a50-9d0c-6f2d784cfc78

This PR is aimed at (1) reducing the private API surface of _MenuAnchorState to make migration into RawMenuAnchor simpler, and (2) fixing focus-related bugs.
Directional focus handling was moved from MenuAnchor (_MenuDirectionalFocusAction, _MenuNextFocusAction, and _MenuPreviousFocusAction) into SubmenuButton (_SubmenuDirectionalFocusAction). MenuAnchor now behaves similarly to a flat FocusScope, which makes it easier to customize. A future PR will ideally expose or remove the remaining internals (_lastItemFocusNode, _firstItemFocusNode, _isRoot, etc). All previous framework tests are passing, and additional tests were added for fixes (MenuAnchor tab traversal, reopened menus not being focusable), and to test MenuAnchor focus behavior separately from MenuBar.
However, one example test had to be changed. I'm not sure why the previous example test was working to begin with, as submenu buttons are supposed to open on focus, but this behavior was not observed in the original test.
Fixes #144381, #150334.
One added feature is the ability to move between top-level horizontal submenus if a horizontal movement is made on a vertical menu item that has no children in the movement direction. This behavior was observed on Google Docs, MacOS, and various other menu systems I encountered.
Screen.Recording.2024-07-01.at.1.37.25.AM.mov
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.