-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tile + TileGroup Accessibility #4606
base: master
Are you sure you want to change the base?
Changes from all commits
8e505a2
c4911b2
ff29c3b
95296c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Accessibility | ||
redirect_from: | ||
- /components/tile/accessibility/ | ||
--- | ||
|
||
# Accessibility | ||
|
||
## Tile | ||
|
||
The Tile component has been designed with accessibility in mind. | ||
|
||
The component offers flexibility in terms of the HTML element used for the root node. By default, it will render a `div` element. | ||
|
||
### Expandable / Clickable | ||
|
||
The prop `expandable` makes the Tile clickable. In that case, assistive props like `ariaExpanded` are handled automatically. | ||
|
||
The component will render, by default, a `div` element with `role="button"` and `tabindex={0}`. | ||
|
||
This also happens when the `onClick` prop is defined. | ||
|
||
For that reason, one should refrain from using other interactive elements inside the Tile, like buttons or links, including on the `header` prop. | ||
|
||
### Href | ||
|
||
When the `href` prop is defined, the Tile will render an `a` element inside of the `div`. | ||
For the same reason as above, one should refrain from using other interactive elements inside the Tile. | ||
|
||
### HTML Title | ||
|
||
The `htmlTitle` prop can be used to add extra information to the Tile. | ||
|
||
It will be added as the `title` attribute to the root element (the `div` with `role="button"`) when the `expandable` is truthy or `onClick` is defined, or to the `a` element when the `href` prop is defined. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is this correct? When the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: Accessibility | ||
redirect_from: | ||
- /components/tilegroup/accessibility/ | ||
--- | ||
|
||
# Accessibility | ||
|
||
## TileGroup | ||
|
||
The TileGroup component has been designed with accessibility in mind. | ||
|
||
The component offers flexibility in terms of the HTML element used for the root node. By default, it will render a `div` element. | ||
|
||
If needed, it can be rendered as a list by passing the `as` prop with the value `"ul"`. | ||
|
||
In that case, the `Tile` elements used as `children` should be rendered as `li`. | ||
|
||
```jsx | ||
<TileGroup as="ul"> | ||
<Tile title="Title" as="li" /> | ||
<Tile title="Title" as="li" /> | ||
</TileGroup> | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe use
aria-expanded
here as that's the name and it's not a custom one, wdyt?