Dismissable admin notices focus loss
|Reported by:||afercia||Owned by:||morganestes|
When activating the button to dismiss an admin notice, the currently focused element (the dismiss button itself) disappears hence there's a focus loss. This is more noticeable in some browsers (e.g. Chrome) while other browsers try to be smarter (e.g. Firefox) and keep focus in place.
To reproduce, use Chrome and edit a post, then press the "Update" button and after page refresh a notice will appear. Using your keyboard, tab through the UI elements and focus the dismiss button. Press Enter.
Now tab again and focus will be on the document root. See screenshot:
Worth noting this is not specific to dismissable notices, it happens every time a focused element gets hidden or removed from the DOM. Every time this happens, users will lose context and will be forced to navigate through several elements just to find again the last place from where they left off.
Since it's a general issue in the admin I initially thought to open a general ticket but then feared it would have been too broad. Decided to start with a small, understandable example to start the discussion and hopefully find a nice, simple, solution :)
As a general rule, every time a focused element gets hidden or removed from the DOM, correctly handling the focus and restoring it in the most logical place should be a developer responsibility.
An interesting reading would be what a blind person (and developer, and Mozillian) thinks about this specific issue:
while the article focuses on modal dialogs, the part about focus loss is pretty relevant.
Change History (26)
- Keywords needs-patch added; has-patch removed
- Owner set to morganestes
- Status changed from new to reviewing
in reply to:
21 months ago
- Keywords needs-testing has-patch added; 2nd-opinion needs-patch removed
- Keywords dev-feedback removed