Skip to content
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

[ticket/16984] Accessibility - fix tab order for keyboard navigation #6379

Draft
wants to merge 1 commit into
base: 3.3.x
Choose a base branch
from

Conversation

lionel-rowe
Copy link
Contributor

@lionel-rowe lionel-rowe commented Apr 6, 2022

Fixes PHPBB3-16984: Accessibility β€” confusing tab order for keyboard navigation

This is a blanket regex find-and-replace of tabindex=(['"]?)[1-9]\d*\1 for tabindex=$10$1 to bring the HTML in-line with the Web AIM guidance:

Important
tabindex values of 1+ must be avoided. These elements will receive keyboard focus before elements with no tabindex value (or tabindex="0") resulting in a navigation order that is different from the visual and/or screen reader order. Instead of using tabindex, simply adjust the page's source code order to support a logical navigation and reading order, then use CSS to adjust the visual presentation.

The source code already uses a logical navigation and reading order, so the fix is simple 😊


Checklist:

  • Correct branch: master for new features; 3.3.x for fixes
  • Tests pass
  • Code follows coding guidelines: master and 3.3.x
  • Commit follows commit message format

Tracker ticket (set the ticket ID to your ticket ID):

https://tracker.phpbb.com/browse/PHPBB3-16984

@marc1706
Copy link
Member

If I read this correctly, the cleaner approach would probably be to completely remove the tabindex? In that case I'd actually then opt for removing it instead of setting it to 0.

@lionel-rowe
Copy link
Contributor Author

lionel-rowe commented Apr 11, 2022

@marc1706 Lack of tabindex isn't always equivalent to tabindex=0:

<!-- `tabindex` can safely be removed, as `input` is already focusable by default -->
<input type="submit" tabindex="0">

<!-- `div` is not usually focusable, so removing `tabindex` would prevent element from being focused -->
<div class="fake-button" tabindex="0"></div>

As most/all of these are inputs though, should be OK to remove β€” I'll do some testing and see if anything breaks.

@lionel-rowe lionel-rowe force-pushed the ticket/16984 branch 2 times, most recently from 5bf7ac1 to eb12cf0 Compare April 16, 2022 22:32
@lionel-rowe lionel-rowe marked this pull request as draft April 28, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants