Skip to content
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

[DO NOT MERGE]: accessibility docs for SWC05 #4757

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a0e49dc
docs: accessibility docs
nikkimk Sep 16, 2024
2ffb8d5
docs(icon): updated docs for a11y
nikkimk Sep 16, 2024
0687744
docs: added accessibility guidelines to icons
nikkimk Sep 16, 2024
fc90ad0
Merge branch 'main' into nikkimk/a11y-docs-iron-man-2
nikkimk Oct 3, 2024
e4a2ed3
docs(action-button): made suggested edits
nikkimk Oct 18, 2024
da21c7c
docs(action-button): made suggested edits
nikkimk Oct 18, 2024
88b13f1
docs(button): made suggested edits
nikkimk Oct 18, 2024
c96896f
docs(icon): made suggested edits
nikkimk Oct 18, 2024
e27b2a3
docs(icon): made suggested edits
nikkimk Oct 18, 2024
9324e03
docs(action-button): made suggested edits
nikkimk Oct 18, 2024
0110fa4
docs(button): made suggested edits
nikkimk Oct 18, 2024
596d1f5
docs(icon): made suggested edits
nikkimk Oct 18, 2024
cfc5193
docs(icons-ui): made suggested edits
nikkimk Oct 18, 2024
0d74c4a
docs(icons): made suggested edits
nikkimk Oct 18, 2024
3c024f3
Merge branch 'main' into nikkimk/a11y-docs-iron-man-2
nikkimk Oct 18, 2024
3a4be0d
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
f0c2f07
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
cd0cee9
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
8fe181c
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
8a6e930
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
2ebcd95
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
36cdb78
docs(button): revised based on feedback
nikkimk Oct 18, 2024
2e044e7
docs(button): revised based on feedback
nikkimk Oct 18, 2024
e1e49d1
docs(button): revised based on feedback
nikkimk Oct 18, 2024
2ef0abc
docs(button): revised based on feedback
nikkimk Oct 18, 2024
ef03652
docs(button): revised based on feedback
nikkimk Oct 18, 2024
cd7ce3a
docs(button): revised based on feedback
nikkimk Oct 18, 2024
29dfeaa
docs(button): revised based on feedback
nikkimk Oct 18, 2024
1f58d89
docs(button): revised based on feedback
nikkimk Oct 18, 2024
3114e64
docs(button): revised based on feedback
nikkimk Oct 18, 2024
ce42b8c
docs: updated heading styles
nikkimk Oct 18, 2024
3f44ba2
docs: updated headings to design recommendations
nikkimk Oct 18, 2024
53dfd3b
fix: adjusted linting rules to resolve issue with missing spectrum-de…
nikkimk Oct 18, 2024
f09655d
docs(icon): revised based on feedback
nikkimk Oct 18, 2024
e98b5e8
docs(button): revised based on feedback
nikkimk Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"length-zero-no-unit": [true, { "ignore": "custom-properties" }],
"selector-type-no-unknown": [true, { "ignore": ["custom-elements"] }],
"selector-pseudo-element-colon-notation": ["single", {}],
"custom-property-pattern": "^_?([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
"custom-property-pattern": "^_?([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
"no-duplicate-selectors": null,
"no-descending-specificity": null
},
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/action-bar/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Description
## Overview

A `<sp-action-bar>` delivers a floating action bar that is a convenient way to deliver stateful actions in cases like selection mode. `<sp-action-bar>` can be deployed in two variants beyond the default: `[varient="fixed"]` to position the element in relation to the page, and `[variant=sticky]` to position the content in relation to content that may scroll.

Expand Down
166 changes: 123 additions & 43 deletions packages/action-button/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Description
## Overview

An `<sp-action-button>` represents an action a user can take.

Expand All @@ -24,9 +24,11 @@ When looking to leverage the `ActionButton` base class as a type and/or for exte
import { ActionButton } from '@spectrum-web-components/action-button';
```

## Sizes
### Options

<sp-tabs selected="m" auto label="Size Attribute Options">
#### Sizes

<sp-tabs selected="m" auto label="Size attribute options">
<sp-tab value="xs">Extra Small</sp-tab>
<sp-tab-panel value="xs">

Expand Down Expand Up @@ -129,11 +131,13 @@ import { ActionButton } from '@spectrum-web-components/action-button';
</sp-tab-panel>
</sp-tabs>

## Variants
#### Variants

The `<sp-action-button>` can be customized with either or both of the `emphasized` and `quiet` attributes. These will pair with either or both of the state attributes (`selected` and `disabled`) to decide the final visual delivery of the `<sp-action-button>`. Content addressed to the `icon` slot can also be provided and will be positioned just before the rest of the the supplied button content.

### Standard
<sp-tabs selected="default" auto label="Variant options">
<sp-tab value="default">Default</sp-tab>
<sp-tab-panel value="default">

```html demo
<div
Expand Down Expand Up @@ -211,7 +215,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
</div>
```

### Quiet
</sp-tab-panel>
<sp-tab value="quiet">Quiet</sp-tab>
<sp-tab-panel value="quiet">

```html demo
<div
Expand Down Expand Up @@ -289,7 +295,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
</div>
```

### Emphasized
</sp-tab-panel>
<sp-tab value="emphasized">Emphasized</sp-tab>
<sp-tab-panel value="emphasized">

```html demo
<div
Expand Down Expand Up @@ -369,7 +377,9 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
</div>
```

### Emphasized + Quiet
</sp-tab-panel>
<sp-tab value="emq">Emphasized + quiet</sp-tab>
<sp-tab-panel value="emq">

```html demo
<div
Expand Down Expand Up @@ -455,7 +465,12 @@ The `<sp-action-button>` can be customized with either or both of the `emphasize
</div>
```

## Action button with hold affordance
</sp-tab-panel>
</sp-tabs>

### Behaviors

#### Action button with hold affordance

The use of the `hold-affordance` attribute signifies that the `<sp-action-button>` in question will be delivered with a visual affordance outlining that special interaction with the button will dispatch a `longpress` event. Via a pointer input, this even will be dispatched when 300ms has passed after a `pointerdown` event without the presence of a `pointerup` or `pointercancel` event. Via the keyboard, an event with a code of `Space` or or `ArrowDown` while `altKey === true` will dispatch the event.

Expand Down Expand Up @@ -499,44 +514,109 @@ The use of the `hold-affordance` attribute signifies that the `<sp-action-button
</div>
```

## Toggles
#### Toggles

With the application of the `toggles` attribute, the button will self manage its `selected` property on `click`. When this value is updated, a cancellable `change` event will be dispatched to inform the parent application.

<sp-tabs selected="default" auto label="Toggled action buttons">
<sp-tab value="default">Default</sp-tab>
<sp-tab-panel value="default">

```html demo
<div
style="display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 2em;"
<sp-action-button toggles id="toggles-default">Toggle button</sp-action-button>
<sp-action-button toggles selected id="toggles-default">
Toggle button
</sp-action-button>
```

</sp-tab-panel>
<sp-tab value="quiet">Quiet</sp-tab>
<sp-tab-panel value="quiet">

```html demo
<sp-action-button toggles quiet id="toggles-quiet">
Toggle button
</sp-action-button>
<sp-action-button toggles quiet selected id="toggles-quiet">
Toggle button
</sp-action-button>
```

</sp-tab-panel>
<sp-tab value="emphasized">Emphasized</sp-tab>
<sp-tab-panel value="emphasized">

```html demo
<sp-action-button toggles emphasized id="toggles-emphasized">
Toggle button
</sp-action-button>
<sp-action-button toggles emphasized selected id="toggles-emphasized">
Toggle button
</sp-action-button>
```

</sp-tab-panel>
<sp-tab value="emphasized-quiet">Emphasized + Quiet</sp-tab>
<sp-tab-panel value="emphasized-quiet">

```html demo
<sp-action-button toggles emphasized quiet id="toggles-emphasized-quiet">
Toggle button
</sp-action-button>
<sp-action-button
toggles
emphasized
quiet
selected
id="toggles-emphasized-quiet"
>
<div>
<sp-field-label for="toggles-default">Standard</sp-field-label>
<sp-action-button toggles id="toggles-default">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-quiet">Quiet</sp-field-label>
<sp-action-button toggles quiet id="toggles-quiet">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-emphasized">Emphasized</sp-field-label>
<sp-action-button toggles emphasized id="toggles-emphasized">
Toggle button
</sp-action-button>
</div>
<div>
<sp-field-label for="toggles-emphasized-quiet">
Emphasized + Quiet
</sp-field-label>
<sp-action-button
toggles
emphasized
quiet
id="toggles-emphasized-quiet"
>
Toggle button
</sp-action-button>
</div>
Toggle button
</sp-action-button>
```

</sp-tab-panel>
</sp-tabs>

### Accessibility guidelines

#### Include a label

A button is required to have either a visible text label or a `label` attribute on either the `<sp-button>` itself,
or on an `<sp-icon*>` element child.

#### Don't override color

Do not use custom colors for buttons. The colors of different button variations have been designed to be consistent and accessible.

#### Use static black or static white to contrast with backgrounds and images

To ensure maximum contrast with the background, use static black for light backgrounds and images, and static white for dark backgrounds and images. Avoid placing static components on top of busy images with a lot of variance in contrast.

<sp-tabs selected="black" auto label="Static variants for contrast">
<sp-tab value="black">Static black on light background</sp-tab>
<sp-tab-panel value="black">

```html demo
<div style="background-color: #ccffee; padding: 20px">
<sp-action-button static="black">Click me</sp-action-button>
<sp-action-button static="black" selected>Click me</sp-action-button>
</div>
```

</sp-tab-panel>
<sp-tab value="white">Static white on dark background</sp-tab>
<sp-tab-panel value="white">

```html demo
<div style="background-color: #220033; padding: 20px">
<sp-action-button static="white">Click me</sp-action-button>
<sp-action-button static="white" selected>Click me</sp-action-button>
</div>
```

</sp-tab-panel>
</sp-tabs>

#### Clearly state the action

Make sure that an action button’s label clearly states the outcome of the action. Use the same word or phrase as found elsewhere in the experience.
10 changes: 6 additions & 4 deletions packages/action-menu/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description
## Overview

An `<sp-action-menu>` is an action button that triggers an overlay with `<sp-menu-items>` for activation. Use an `<sp-menu>` element to outline the items that will be made available to the user when interacting with the `<sp-action-menu>` element. By default `<sp-action-menu>` does not manage a selection. If you'd like for a selection to be held by the `<sp-menu>` that is presented in its overlay, use `selects="single"` to activate this functionality.
An `<sp-action-menu>` is an action button that triggers an overlay with `<sp-menu-items>` for activation. Use an `<sp-menu>` element to outline the items that will be made available to the user when interacting with the `<sp-action-menu>` element. By default, `<sp-action-menu>` does not manage a selection. If you'd like for a selection to be managed, use `selects="single"` on the `<sp-menu>` to activate this functionality.

### Usage

Expand Down Expand Up @@ -30,9 +30,11 @@ When looking to leverage the `ActionMenu` base class as a type and/or for extens
import { ActionMenu } from '@spectrum-web-components/action-menu';
```

## Sizes
### Options

<sp-tabs selected="m" auto label="Size Attribute Options">
#### Sizes

<sp-tabs selected="m" auto label="Size attribute options">
<sp-tab value="s">Small</sp-tab>
<sp-tab-panel value="s">

Expand Down
14 changes: 11 additions & 3 deletions packages/button-group/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Description
## Overview

`sp-button-group` delivers a set of buttons in horizontal or vertical orientation while ensuring the appropriate spacing between those buttons.

Expand All @@ -24,7 +24,11 @@ When looking to leverage the `ButtonGroup` base class as a type and/or for exten
import { ButtonGroup } from '@spectrum-web-components/button-group';
```

## Horizontal
### Options

A button group can be either horizontal or vertical in its orientation. By default, a button group is horizontal. Use vertical option when horizontal space is limited.

#### Horizontal

```html
<sp-button-group>
Expand All @@ -34,7 +38,7 @@ import { ButtonGroup } from '@spectrum-web-components/button-group';
</sp-button-group>
```

## Vertical
#### Vertical

```html
<sp-button-group vertical>
Expand All @@ -43,3 +47,7 @@ import { ButtonGroup } from '@spectrum-web-components/button-group';
<sp-button>Short 3</sp-button>
</sp-button-group>
```

### Accessibility guidelines

Review the guidelines for the [button](../button#accessibility-guidelines) children.
Loading
Loading