-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
The placement of focus after opening dropdowns #11838
Comments
Question: What should get focused after opening the dropdown? Should it be the first item or should it be the first active option?
So unless the best practices doesn't explicitly say what should be focused we can go either way (whatever will be quicker to implement). |
According to ARIA 1.2 specification and ARIA Practices, it depends on the type of the dropdown. For menus (so basically lists of actions), it should be the first element inside them. AFAIK we don't have typical menus in CKE5. For comboboxes, it should generally be the selected element (or, if nothing is selected, the first one). Most of our dropdowns are comboboxes so IMO it's the way to go. |
Sounds good! FYI: tracking this at https://www.drupal.org/project/drupal/issues/3283801 😊 |
Thanks for summing it up @Comandeer - this sounds reasonable. |
|
Actually this fix could also resolve #5859 🎉 I just checked Chrome and focusing a button that is outside of viewport (overflowed element) will scroll the viewport nicely to center on the focused option. |
…fter-opening-dropdowns Fix (ui): Opening a dropdown should focus the first item (or the first active item) for easier navigation and accessibility. Closes #11838. Closes #2000. Closes #11568. Closes #3215. Closes #5859. MINOR BREAKING CHANGE (ui): Until now, `preventDefault()` was called on the `mousedown` event to prevent the [`ButtonView`](https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_button_buttonview-ButtonView.html) from "stealing" the focus from the editing root. Starting from this editor version, to improve the accessibility of the editor, all instances of the [`ButtonView`](https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_button_buttonview-ButtonView.html) class (and child classes) will automatically focus in DOM when clicked. It is recommended that features that use buttons to manage the content call `editor.editing.view.focus()` after the button was [executed](https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_button_buttonview-ButtonView.html#event-execute) in order to bring the DOM focus back to the editing root to allow users type right away.
📝 Provide detailed reproduction steps (if any)
✔️ Expected result
The focus is moved to the first child (first focusable element) inside the open dropdown.
❌ Actual result
The focus stays on the pressed button.
However, some dropdowns (e.g. media embed one) moves focus to the first focusable element upon opening.
❓ Possible solution
Make all dropdowns consistent and move focus to the first focusable element. See ARIA Practices for more info.
📃 Other details
See also #2000.
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: