Visually Hidden
v0.0.10
v0.0.10StableHeadlessStatelessAccessibleApache-2.0
Installation
mix mishka.ui.gen.headless visually_hidden
Source
View Source
Other uses
Add context to a link whose visible text is the same on every row.
heex
<a href={"/posts/#{post.id}"}>
Read more
<.visually_hidden>about {post.title}</.visually_hidden>
</a>Or hold the text of a live region, so a status change is announced without changing the layout.
heex
<.visually_hidden aria-live="polite">{@status}</.visually_hidden>Parts & data attributes
There are no inner parts and no state attributes. The root is a single span around the slot content.
Accessibility
Hidden text stays in the accessibility tree, so screen readers read it in place. Put it inside the control it describes, and it becomes part of that control's accessible name. Do not use it for content that sighted keyboard users also need, because it cannot be revealed on focus.
Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | No | Optional unique id |
class
|
any
| — | — | No | Extra classes |
rest
|
global
| — | — | No | — |
Slots
| Name | Required | Description |
|---|---|---|
inner_block
| Yes | The screen-reader-only content |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--type
|
visually_hidden
|
--module
| A module name of your own |
What it generates
Functions
visually_hidden
Helpers
None
Generated with it
None
Command
mix mishka.ui.gen.headless visually_hidden