Skip to content

Focus ring via :focus-visible #463

Closed

Description

@svinkle

Description

It may be desirable to remove the default focus ring which appears on mouse click. For <model-viewer> to be accessible and compliant there must be a focus ring visible when keyboard users interact with the model. This is a requirement from WCAG 2.4.7 Focus Visible.

A possible work-around would be to implement the :focus-visible polyfill which, I assume, would be encapsulated within <model-viewer>. With this in place, we'd be free to remove the outline for mouse/touch, and display the outline for keyboard only.

/*
  Provide basic, default focus styles.
*/
canvas:focus {
  …
}

/*
  Remove default focus styles for mouse users ONLY if
  :focus-visible is supported on this platform.
*/
canvas:focus:not(:focus-visible) {
  …
}

/*
  Optionally: If :focus-visible is supported on this
  platform, provide enhanced focus styles for keyboard
  focus.
*/
canvas:focus-visible {
  …
}

Screen Shot 2019-04-02 at 9 44 31 AM

Live Demo

Browser Affected

  • Chrome
  • Edge
  • Firefox
  • Helios
  • IE
  • Safari

OS

  • Android
  • iOS
  • Linux
  • MacOS
  • Windows

Versions

  • model-viewer: v0.1.1

Activity

  1. cdata commented on Apr 2, 2019

    @cdata
    Contributor

    Awesome! Yeah, I think we need to explore support for :focus-visible. I need to read up more about the polyfill. My uneducated, gut reaction is that we would not bundle the polyfill, but rather support it to the best of our ability if it happens to be included on the page (just as we do for other polyfills).

  2. svinkle commented on Apr 3, 2019

    @svinkle
    Author

    Ah yeah, that makes sense. Don't bundle but rather, add "support" for in case the page is set to use it.

    I'll need to see about adding the polyfill on our end. 👍

  3. self-assigned this
    on Apr 28, 2019
  4. cdata commented on Apr 28, 2019

    @cdata
    Contributor

    I attempted to integrate the suggested polyfill. Unfortunately, it became clear that the polyfill does not support focus as it traverses within shadow roots.

    I left some thoughts on the topic while I was in the process discovering this the hard way here.

  5. cdata commented on May 2, 2019

    @cdata
    Contributor

    I have opened WICG/focus-visible#196 to add Shadow DOM support.

  6. cdata commented on May 15, 2019

    @cdata
    Contributor

    WICG/focus-visible#196 as been approved, so we should be able to move forward with a aspirational integration.

  7. added
    flag: partner
    on May 15, 2019
  8. added this to the v0.5.0 milestone on Jun 6, 2019
  9. pushmatrix commented on Jun 10, 2019

    @pushmatrix
    Contributor

    Why was this iceboxed?

  10. cdata commented on Jun 10, 2019

    @cdata
    Contributor

    We were waiting on the next release of the polyfill, so I moved this into v0.5.0 release while we focus on v0.4.0.

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

Metadata

Metadata

Assignees

Labels

arc: customizationarc: interactionflag: partnertype: feature

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions