Use ld-sr-only
to hide an element visually without hiding it from screen readers.
The CSS class ld-sr-only
works the same way as its Web Component counterpart, except that it can be applied to an HTML element directly while the Web Component wraps the element which needs to be only screen reader visible.
<ld-sr-only>Hello screen reader</ld-sr-only>
<span class="ld-sr-only">Hello screen reader</span>
<LdSrOnly>Hello screen reader</LdSrOnly>
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
key |
key |
for tracking the node's identity when working with lists | string | number |
undefined |
ref |
ref |
reference to component | any |
undefined |
graph TD;
ld-sidenav-header --> ld-sr-only
ld-sidenav-toggle-outside --> ld-sr-only
ld-slider --> ld-sr-only
ld-sr-live --> ld-sr-only
ld-step --> ld-sr-only
ld-stepper --> ld-sr-only
ld-tooltip --> ld-sr-only
style ld-sr-only fill:#f9f,stroke:#333,stroke-width:4px
Built with StencilJS