Skip to content

[aria] Request: Provide a way to hide focusable elements from only assistive technologies #2447

@ianthedev

Description

@ianthedev

Say, on a web developer's personal page, there is an unordered list showing icons of web development skills which the developer has. And when mouse cursor or keyboard interacts with an icon, a tooltip would show up letting sighted visitors know the skill name. The HTML markup of the unordered list would be:

<ul>
	<li>
		<span class="visually-hidden">HTML</span>
		<button type="button" aria-hidden="true">
			<img src="icon-html.png" alt="">
			<span class="tooltip">HTML</span>
		</button>
	</li>
	<li>
		<span class="visually-hidden">CSS</span>
		<button type="button" aria-hidden="true">
			<img src="icon-css.png" alt="">
			<span class="tooltip">CSS</span>
		</button>
	</li>
	<li>
		<span class="visually-hidden">JavaScript</span>
		<button type="button" aria-hidden="true">
			<img src="icon-javascript.png" alt="">
			<span class="tooltip">JavaScript</span>
		</button>
	</li>
</ul>

Each list item contains a direct child span element, which is for assistive technologies to read and will be made visually hidden through CSS.

Each list item also contains a direct child button element, which contains a small img element followed by a span element. The small img element is used as an icon and the span element is to be displayed as a tooltip. These button elements are for mouse cursor and keyboard to interact with and display the tooltips to sighted users, so I use aria-hidden="true" on them to try to hide them from assistive technologies.

The problem is, the button elements would still be focusable to assistive technologies and would therefore confuse users of assistive technologies. And tabindex="-1" would not help here because it would make the buttons unfocusable to sighted keyboard users, too.

To solve this problem, we need a way to hide a focusable element from only assistive technologies.

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