-
Notifications
You must be signed in to change notification settings - Fork 28.8k
add autofocus to fix a11y issue with dialog #152637
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
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.
The correct behavior is to focus on the first item in screen order when a new page or dialog is pushed, which is the "This is a typical dialog".
I am not sure if this is possible for web though.
cc @yjbanov I think this should be the default behavior, but I remembered you mention web engine had trouble detecting a new page is pushed |
In most cases, yes this is the correct behavior. According to APG, the initial focus can be variable depending on the circumstance of the dialog and what makes most sense for the user. Since this is a simple dialog that conveys information to a user, focus should be set on the first focusable element of "Ok" An example can be seen at this link: Once at the page click on the "Add Delivery Address" button and once the dialog is open, click "Add" at the bottom. Notice that initial focus is set on the OK button, which is the last focusable element. This is for efficiency since most users will simply dismiss the dialog as soon as they have read the message. Due to the variability in interactive elements that can be in a dialog, initial focus is variable and it sounds like it's really up to the developer to know which initial focus use case is best. However, I believe in this case in particular for the dialog testing, initial focus should be put on the "Ok" button. |
96c4e25
to
d5a602f
Compare
thanks for explanation, I am ok with using auto focus to get around the current behavior. However, the current behavior is not ideal, looks like it doesn't focus anything. Looking at the semantics tree from the browser devtool, it seems like it is not generating a dialog div. This is something we should look into cc @yjbanov, but not necessary in this pr. |
filed #153791 |
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
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
Add autofocus=true to first TextButton in dialog so that focus automatically goes to an interactive element when dialog is opened. Before: https://screencast.googleplex.com/cast/NTYxNTczMTk2MDk3MTI2NHxlMjAyOTMzZi1lNw After: https://screencast.googleplex.com/cast/NTk1NzMxNjYxNTYwMjE3NnxlYWNlM2Q1MC1jYw fixes b/338656477 NOTE: This would be a good candidate to update the documentation for Dialogs and TextButtons to encourage the user to add autofocus=true on at least one button so that focus automatically goes to an interactive element instead of the actual Dialog element.
Add autofocus=true to first TextButton in dialog so that focus automatically goes to an interactive element when dialog is opened.
Before: https://screencast.googleplex.com/cast/NTYxNTczMTk2MDk3MTI2NHxlMjAyOTMzZi1lNw
After: https://screencast.googleplex.com/cast/NTk1NzMxNjYxNTYwMjE3NnxlYWNlM2Q1MC1jYw
fixes b/338656477
NOTE: This would be a good candidate to update the documentation for Dialogs and TextButtons to encourage the user to add autofocus=true on at least one button so that focus automatically goes to an interactive element instead of the actual Dialog element.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.