Opened 7 years ago
Closed 6 years ago
#7714 closed defect (bug) (fixed)
BP-Nouveau: Keyboard focus lost in air with Messages bulk actions UI
Reported by: | mercime | Owned by: | mercime |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Templates | Keywords: | has-screenshots has-patch commit |
Cc: |
Description
The current bulk actions UI hides the options for the bulk actions off-screen using .bp-hide class which causes keyboard focus to jump to the top ala #7711 after tabbing through the checkbox:
.bp-hide { height: 0; left: -999em; overflow: hidden; position: absolute; top: -999em; }
We could restructure the new Messages bulk actions UI to be similar in functionality to Gmail's custom components which are accessible for visual users, screen readers users, and keyboard users.
- Instead of using
<input type="checkbox" ...>
we could use the "div for interactive elements that do something" - the semantic<button>
element. - Add
aria-haspopup="true" aria-expanded="false" bp-tooltip="Select messages bulk action" aria-label="Select messages bulk action"
or better yet, remove thearia-label
andbp-tooltip
and show text in button instead. Use JavaScript to change state toaria-expanded="true"
when clicked on - For the options available, use
div
withrole="menu" aria-haspopup="true"
to wrap all options, each option is wrapped withrole="menu-item"
and use JS to indicate which is selected.
Attachments (6)
Change History (18)
#4
@
6 years ago
- Keywords has-patch added
In attached patch, kept most of the original structure and made the following changes to fix the focus jump along with some other enhancements:
- Removed the
bp-screen-reader-text
class from thelabel
of thecheckbox
for some words - Added
.bp-hide
and.bp-show
classes for.bulk-actions-wrap
div in buddypress-messages.js - Removed the nesting of the
checkbox
within thelabel
element for both the bulk action and the message threads - Added tooltip to the bulk-actions button which has a
check
icon - Moved the
li.user-messages-bulk-actions
to after theli.user-messages-search
so that the bulk actions will be closer to the message thread on desktop and especially on mobile view. See attached messages-bulk-action-fix-mobile.gif and messages-bulk-action-fix-desktop.gif attached. - Added style support for above-mentioned.
For review/comments.
#5
@
6 years ago
In the patch:
<label for="user_messages_select_all"><span class="bp-screen-reader-text"><?php esc_html_e( 'Select ', 'buddypress' ); ?></span><?php esc_html_e( 'All Messages', 'buddypress' ); ?></label>
- The string can't be split. This is meaningfully untranslatable.
I trust you with the rest of the markup changes.
#6
@
6 years ago
Thanks for the review @djpaul. Attached 7714.2.patch removes the span
with the bp-screen-reader-text class.
#7
@
6 years ago
Thanks - commit when you're happy. I trust you with the rest of the markup changes, but if you want those reviewed, I can help corral someone into looking.
#8
@
6 years ago
I would like to review please before commits are made, I too trust to the changes and the keyboard focus issue is good catch and important but would like to check the changes over.
#9
@
6 years ago
@mercime yep like the additional enhancements & in addition perhaps would quite like to remove the initial border wrapping the hidden select/action popup when shown, this is for two reasons #1 it removes the slight page jump to accommodate the element inline ( border adds height ) and #2 having the element(s) show without border gives a more text like visual style that fits better with your text addition 'All Messages', also on hover of the select we do have a border appear to help define this as a select element visually ( which could be increased in strength/color)
.buddypress-wrap .subnav-filters .user-messages-bulk-actions .bulk-actions-wrap { border: 1px solid #eee; }
Other than that I do have a major concern over the input elements being used without a form parent and where they don't need strictly to be inputs ( as you mention earlier) if we are only passing data to scripts ( a bad thing but...) not sure what we can do about this though at this stage.
Ignoring the above input concern lets bash this in, the focus is important the enhancements good and if we can pull out the border style above I'm happy :)
In r11906:
Nouveau: Fix keyboard focus for hidden form controls.
This prevents loss of focus for keyboard users as they tab through the form
controls where initial state is hidden.
Fixes #7711, #7720. See #7714.