Skip to content

Subtree isolation with aria-hidden blocked in subtree that contains activate trap button #1747

@stefcameron

Description

@stefcameron

Thanks @andy-blum @stefcameron.

I see a warning appearing in the Google Chrome console when using aria-hidden.

To reproduce the problem, go to https://focus-trap.github.io/focus-trap/#isolate-subtree-heading and click on the "activate outer trap (aria-hidden)" button. The following message appears in the Google Chrome console:

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus: <button#activate-isolate-subtree-aria>
Ancestor with aria-hidden: <p aria-hidden=​"true">​…​</p>​

I don't know exactly how to solve this problem, but perhaps you should first move the focus to the trap element and then add aria-hidden attribute (rather than doing both actions at the same time).

Originally posted by @msev in #1575

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions