Problem/Motivation
On most ajax triggered actions, we are losing the focus on the triggering element as it is removed from the dom then re-added.
That forces screen readers users or people navigating with their keyboard to restart from the beginning of the page.
Steps to reproduce
- Install drupal standard
- Go to the views add form (admin/structure/views/add)
- Focus the "View settings"> "Show" field with your keyboard
- Change its value using the keyboard
- Once it has been reloaded, hit tab
Expected result: the field just after the "Show" field is focused
Current result: the "Skip to main content" link is focused
Proposed resolution
Refocus the triggering element at the end of the ajax call unless an other element has been explicitely focused by the ajax call.
Remaining tasks
Task | Novice task? | Contributor instructions | Complete? |
---|---|---|---|
Create a patch | Instructions | Done | |
Update the issue summary | Instructions | Done | |
Update the issue summary noting if allowed during the beta | Instructions | Done | |
Manually test the patch | Novice | Instructions | |
Add steps to reproduce the issue | Novice | Instructions | Done |
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards | Instructions |
User interface changes
None.
API changes
None.
Data model changes
None.
Why this should be an RC target
Without this patch, the admin side of Drupal will be more difficult for screen reader users and keyboard only users to navigate. Predictability is really important for blind users and having the cursor location move unexpectedly can be a major disruption.
RC phase evaluation
Issue category | Bug because the expected behavior is to keep the focused element |
---|---|
Issue priority | Normal because it only affects a really small percentage of users |
Needed in RC | The main goal of this issue is accessibility. (Reduces screen readers pain using the Drupal interface) |
Disruption: Fixes a bug, blocks a contributed project, or should be backported to Drupal 7 | Not disruptive as it takes care to do nothing in the case the focus were called by the ajax response on purpose. |