Accessibility Fix: Add tooltips to import, export, and modal close buttons#667
Accessibility Fix: Add tooltips to import, export, and modal close buttons#667aurooba wants to merge 5 commits intoWordPress:trunkfrom
Conversation
|
Note: these should really be translation ready. Is there something already included within Playground that we can wrap this in, some kind of |
dmsnell
left a comment
There was a problem hiding this comment.
thanks for the insight, @aurooba
I've got a question about duplicating the aria-label value when the title exists, but otherwise this seems like a good change we can merge quickly.
unfortunately there's no system in place yet here for translation strings, unless I'm mistaken.
| className={css.btn} | ||
| aria-label="Download Playground export as ZIP file" | ||
| aria-label={exportButtonAriaLabel} | ||
| title={exportButtonAriaLabel} |
There was a problem hiding this comment.
with the title set is the aria-label necessary? I was led to believe that it becomes redundant at that point, and only matters if the aria-label value is different than the title, in which case its value is preferred.
There was a problem hiding this comment.
Yes! Although screen-readers will read the title if it's there (in some cases only), they prefer aria-label and users can set preferences where only aria-label is read. So it's considered a better practice to include both. Here's some more information: https://www.a11yproject.com/posts/title-attributes/
|
Actually, the Thanks. |
alexstine
left a comment
There was a problem hiding this comment.
While we're here, some labeling notes.
| return null; | ||
| } | ||
|
|
||
| const exportButtonAriaLabel = 'Download Playground export as ZIP file'; |
There was a problem hiding this comment.
Save verbosity?
| const exportButtonAriaLabel = 'Download Playground export as ZIP file'; | |
| const exportButtonAriaLabel = 'Download configuration .zip file'; |
There was a problem hiding this comment.
I would suggest a further change, Export configuration .zip file
| const [isOpen, setOpen] = useState(false); | ||
| const openModal = () => setOpen(true); | ||
| const closeModal = () => setOpen(false); | ||
| const importButtonAriaLabel = 'Open Playground import window'; |
There was a problem hiding this comment.
This text is redundant.
| const importButtonAriaLabel = 'Open Playground import window'; | |
| const importButtonAriaLabel = 'Import configuration'; |
| }; | ||
|
|
||
| export default function Modal(props: ModalProps) { | ||
| const closeBtnAriaLabel = 'Close import window'; |
There was a problem hiding this comment.
Since the modal provides current context, can shorten to just Close.
| const closeBtnAriaLabel = 'Close import window'; | |
| const closeBtnAriaLabel = 'Close'; |
|
@alexstine Good call on changing the labels, I didn't want to express any opinions there but I agree that the actual language could be updated, and I agree with your suggestions. Regarding the Should we skip using For reference, in the Block Editor, the tooltip component uses the @ariakit/react Tooltip component |
Co-authored-by: aurooba <aurooba@auroobamakes.com Co-authored-by: alexstine <alex.stine@yourtechadvisors.com>
This reverts commit 35e98e0.
|
@aurooba Why not use the one from Gutenberg WordPress components? https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/tooltip |
|
This is lovely @aurooba, thank you so much!
Yeah, the button could be much clearer about its purpose. Let's take a step back and think of what a clearer button would look like. Maybe let's replacing these icons with textual buttons like |
## What is this PR doing? Puts additional actions in a single, accessible dropdown menu instead of jamming more ambiguous icons in the "toolbar". Closes #667
What is this PR doing?
This PR adds tooltips to the import, export, and modal close buttons.
What problem is it solving?
While they already have
aria-labelvisually users still need the tooltips so they can understand what these icon buttons do without interacting with them first.How is the problem addressed?
A
titleattribute has been added to eachbuttonelement that has the same text as thearia-labelhelper text.Testing Instructions
Screenshot