-
Notifications
You must be signed in to change notification settings - Fork 231
docs(avatar): update a11y docs #5665
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
Open
cdransf
wants to merge
1
commit into
main
Choose a base branch
from
cdransf/avatar-docs-audit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+23
−7
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
## Description | ||
## Overview | ||
|
||
An `<sp-avatar>` is a great way to feature a visual representation of a user. | ||
An `<sp-avatar>` is a thumbnail representation of an entity, such as a user or an organization. Avatars can have a defined image, which is usually uploaded by a user. | ||
|
||
[View the design documentation for this component.](https://spectrum.adobe.com/page/avatar/) | ||
|
||
### Usage | ||
|
||
[](https://www.npmjs.com/package/@spectrum-web-components/avatar) | ||
[](https://bundlephobia.com/result?p=@spectrum-web-components/avatar) | ||
[](https://stackblitz.com/edit/vitejs-vite-swzc3ix8) | ||
|
||
``` | ||
```zsh | ||
yarn add @spectrum-web-components/avatar | ||
``` | ||
|
||
Import the side effectful registration of `<sp-avatar>` via: | ||
|
||
``` | ||
```js | ||
import '@spectrum-web-components/avatar/sp-avatar.js'; | ||
``` | ||
|
||
When looking to leverage the `Avatar` base class as a type and/or for extension purposes, do so via: | ||
|
||
``` | ||
```js | ||
import { Avatar } from '@spectrum-web-components/avatar'; | ||
``` | ||
|
||
## Sizes | ||
### Options | ||
|
||
#### Sizes | ||
|
||
Avatar sizes scale exponentially, based on the Spectrum type scale. These range from `size-50` to `size-700`. An avatar can also be customized to fit appropriately for your context. | ||
|
||
<sp-tabs selected="100" auto label="Size Attribute Options"> | ||
<sp-tab value="50">50</sp-tab> | ||
|
@@ -137,6 +143,16 @@ import { Avatar } from '@spectrum-web-components/avatar'; | |
</sp-tab-panel> | ||
</sp-tabs> | ||
|
||
## Accessibility | ||
### States | ||
|
||
#### Generic avatars | ||
|
||
Use branded generic avatars when a user has not set their avatar image. These images are designed to be abstracted from all genders, locales, and cultures. | ||
Comment on lines
+148
to
+150
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. This feels less like a state, but I'm not sure it's necessarily an option either. Thoughts? |
||
|
||
#### Disabled | ||
|
||
An avatar in a disabled state shows that an avatar exists, but is not available or a user is not active in that circumstance. This can be used to maintain layout continuity and communicate that an avatar may become available or active later. | ||
|
||
### Accessibility | ||
|
||
The `label` attribute of the `<sp-avatar>` will be passed into the `<img>` element as the `alt` tag for use in defining a textual representation of the image displayed. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's a default size, right? That feels like something we could mention here.