Skip to content

Explicit display:none should prevent element from being used as relevant canvas fallback content #7534

Open
@Loirooriol

Description

@Loirooriol

https://html.spec.whatwg.org/multipage/canvas.html#being-used-as-relevant-canvas-fallback-content

An element whose nearest canvas element ancestor is being rendered and represents embedded content is an element that is being used as relevant canvas fallback content.

https://html.spec.whatwg.org/multipage/interaction.html#focusable-area

Focusable area Examples
Elements that meet all the following criteria:

  • the element's tabindex value is non-null, or the element is determined by the user agent to be focusable;
  • the element is either not a shadow host, or has a shadow root whose delegates focus is false;
  • the element is not actually disabled;
  • the element is not expressly inert;
  • the element is either being rendered or being used as relevant canvas fallback content.

But let's say you have multiple fallbacks and choose between them with display:none:

<canvas>
  <div id="fallback1" style="display:none">
    <span tabindex="1">Fallback1</span>
  </div>
  <div id="fallback2">
    <span tabindex="1">Fallback2</span>
  </div>
</cavas>

As @lilles told me, in the case where we should render the fallback content, #fallback1>span would not be focusable. It sounds unintentional that all of the fallback content should be focusable if we render the canvas and not render the fallback.

Also, it's already not focusable in Firefox, and I plan to make it not focusable in Blink, since it helps for inert. The spec lists "not expressly inert" as a condition for being focusable, but typically browsers don't compute styles in display: none subtrees. But all Blink, WebKit and Gecko have converged to track inertness in the computed style, so it may not be known if the element is inert or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11y-trackerGroup bringing to attention of a11y, or tracked by the a11y Group but not needing response.accessibilityAffects accessibilitytopic: canvastopic: focus

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions