Skip to content

Fix poster a11y - #924

Merged
cdata merged 4 commits into
masterfrom
fixA11y
Dec 13, 2019
Merged

cdata merged 4 commits into
masterfrom
fixA11y

Conversation

@elalish

@elalish elalish commented Dec 11, 2019

Copy link
Copy Markdown
Contributor

Fixes #905

@svinkle I think I fixed this, but confirmation from someone who knows accessibility better than myself would be great.

I also took the opportunity to update some three.js methods that were deprecated and were spewing ugly warnings on the console.

@elalish
elalish requested a review from cdata December 11, 2019 21:45
@elalish elalish self-assigned this Dec 11, 2019
@cdata

cdata commented Dec 11, 2019

Copy link
Copy Markdown
Contributor

Thanks for also fixing those ugly warnings 💯

Comment thread src/template.ts
width: 100%;
height: 100%;
position: absolute;
border: none;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<button> has padding by default that we probably want to remove: padding: 0;

@cdata

cdata commented Dec 11, 2019

Copy link
Copy Markdown
Contributor

I think we might need to tweak how we adjust tabIndex on the element as well. Currently, we add a tabindex to make the <div> focusable, but <button> has implicit focusability and does not require this. On the flip side, we also remove the attribute in an attempt to remove the poster from focus traversal.

I'm not totally sure what the ideal approach to hiding the poster should be, but one option is to set tabindex to -1, which retains focusability but removes the element from the focus traversal order when tabbing.

@svinkle do you have any suggestions here?

Comment thread src/template.ts
<div class="slot poster">
<slot name="poster">
<div id="default-poster" aria-hidden="true" aria-label="Activate to view in 3D!"></div>
<button type="button" id="default-poster" aria-hidden="true" aria-label="Activate to view in 3D!"></button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-hidden="true" hides this element from assistive technology (yet the tab-stop remains.) Please remove the aria-hidden attribute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@svinkle the poster starts out in a hidden state unless the user configures it to be visible. If we don't do this, then it is always possible for the user to tab through the poster even when it is not configured or otherwise visible.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdata Got it. Noticed this when reading through $showPoster().

@svinkle

svinkle commented Dec 12, 2019 •

Copy link
Copy Markdown

There's a few ways to approach this:

  • Remove from DOM completely
    defaultPosterElement.remove();
  • Hide using hidden attribute
    defaultPosterElement.hidden = true;
  • Adjust some attributes
    defaultPosterElement.setAttribute('aria-hidden', 'true');
    defaultPosterElement.setAttribute('tabindex', -1);
  • Apply inert (if available)
    defaultPosterElement.inert = true;
  • Hide using CSS display: none

Each will remove the element from all users and assistive technology.

The other question to this process is once the poster is activate and removed, how is keyboard focus managed? Ideally since the poster is used to "reveal" the 3D model, focus would shift to the canvas element. From this point the user will hear the announcement of the 3d model when it receives focus and can proceed with interacting with the model. This would also provide confirmation of a successful poster click event.

@cdata

cdata commented Dec 13, 2019

Copy link
Copy Markdown
Contributor

Thanks for the feedback @svinkle ! To your question about poster focus, we do indeed already forward focus to the <canvas> once the poster is activated.

I have updated this PR to swap the previous tabindex logic.

@cdata
cdata merged commit 796e8e4 into master Dec 13, 2019
@cdata
cdata deleted the fixA11y branch December 13, 2019 18:31
@cdata cdata added this to the v0.8.0 milestone Dec 19, 2019
elalish added a commit to elalish/model-viewer that referenced this pull request Feb 4, 2020
* poster -> button

* updated to current three.js methods

* addressing feedback

* Swap tabindex logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default poster element creates accessibility barrier

3 participants