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
♿ [Story a11y] Improve tabbing on social-share and bookend #32859
♿ [Story a11y] Improve tabbing on social-share and bookend #32859
Conversation
Hey @gmajoulet, @newmuis, @Enriqe! These files were changed:
|
An alternate approach: It may have side effects depending on which node is being transformed. Do you think there's value in trying that? It might be less code. |
@processprocess Absolutely, let me try that. I suspect that the animations would break since we're hiding the element when not visible |
@processprocess seems like the shadow dom does interfere but it was worth the effort to get it working through the shadow dom since the code is much clearer this way, PTAL. Animations don't break since the visibility attribute changes gradually |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already set aria-hidden=bool
from the draggable-drawer class, that's supposed to take care of this
this.element.setAttribute('aria-hidden', false); |
Why is this not working? Let's fix it instead of introducing yet another way to do the same thing
@processprocess I'll check if the "copy to clipboard" can be triggered from the keyboard, and if it's a couple of lines of code we can do it here.
@gmajoulet https://web.dev/aria-hidden-focus/ "Using the aria-hidden="true" attribute on an element hides the element and all its children from screen readers and other assistive technologies. If the hidden element contains a focusable element, assistive technologies won't read the focusable element, but keyboard users will still be able to navigate to it, which can cause confusion." We may be able to remove the |
That's good to know thank you. So let's write the fix at the same level so the logic is not split in between two files. The draggable drawer sets aria-hidden to true/false on open/close, and it also sets a TLDR: add the visibility rule on |
@gmajoulet had to deal with transitioning the visibility with a delay so it doesn't break the animations, but worked. Thanks for the suggestion! PTAL at the fix. |
…tabinactive_bookend
…/amphtml into ampstory_tabinactive_bookend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with a couple nits/suggestions.
|
||
.i-amphtml-story-share-icon:active::before { | ||
background-color: #787878 !important; | ||
outline: 2px solid #0389ff !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
It's best practice to not override default browser state for a11y. I think we can remove this override.
The outline below it is a nice touch though to help it be visible.
It might be worth putting a comment above this block stating that it's for a11y.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for these elements (being custom elements / divs and not necessarily buttons) is to not have anything for the focus state, so this is super useful to know what the user is focusing on. I can add a comment, but I wonder if it's not clear enough if it's inside a rule with the :focus
selector
@@ -277,6 +289,13 @@ export class ShareWidget { | |||
e.preventDefault(); | |||
this.copyUrlToClipboard_(); | |||
}); | |||
listen(linkShareButton, 'keyup', (e) => { | |||
const code = e.charCode || e.keyCode; | |||
if (code === 32 || code === 13) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
I wonder if this needs a comment for what keys these are for quick readability.
I think we commonly do top level CONSTs but maybe that's overkill for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to add a comment for this, it's not immediately obvious what these are
Part of #31747
Mentioned in #32511
When tabbing through the story, landing on the share icons or the bookend links will scroll the viewport outside the story area.
Changes:
@ampproject/wg-stories