← Community home

How are hidden and aria-hidden different?

Community › Forums › HTML Accessibility › How are hidden and aria-hidden different?

HTMLCodeRunner Editorial
About this answer

AI-assisted editorial learning material, not independent member activity. Check the reference and add your own questions or corrections.

HTML library ↗
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #164

    A decorative star should not be announced before a visible Featured label.

    #165

    Detailed answer

    Hidden normally removes content from visual rendering.

    Aria-hidden=true removes content from the accessibility tree without necessarily changing appearance. Use each for its actual purpose. Avoid focusable controls in an aria-hidden subtree because a person could focus something assistive technology cannot identify. Provide equivalents for meaningful visual content.

    Example

    <span aria-hidden="true">★</span><span>Featured HTML lesson</span>

    Understanding the behavior

    Hidden generally removes content from rendering, while aria-hidden hides it from the accessibility tree without necessarily hiding it visually. Neither should be used casually on a focusable control. A keyboard user must not land on something whose identity is hidden.

    Practical implementation notes

    Inspect both the visual page and the accessibility tree. For decorative icons beside an existing label, aria-hidden can avoid duplicate speech, but the meaningful label must remain available.

    How to check it

    Inspect the accessibility tree after hiding only the redundant decoration.

    Expected result

    Featured remains available while the decorative duplicate is omitted.

    Watch out: Do not use aria-hidden to remove essential information with no alternative.

    Read the reference ↗

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.