Skip to content

Commit f8299a1

Browse files
geurtsdlockhart
andauthored
feat: DAYL-95 > Improve a11y docn (#6406)
* Add a11y section and add a11y tag to property descriptions * Update components/inputs/docs/input-color.md Co-authored-by: Dave Lockhart <dlockhart@users.noreply.github.com> * Update input-color.md --------- Co-authored-by: Dave Lockhart <dlockhart@users.noreply.github.com>
1 parent 9243ef6 commit f8299a1

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

components/inputs/docs/input-color.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ input.addEventListener('change', (e) => {
5555
* `inline-help`: Help text that will appear below the input. Use this only when other helpful cues are not sufficient, such as a carefully-worded label.
5656
<!-- docs: end hidden content -->
5757

58-
### Accessibility Properties
58+
## Accessibility
5959

60-
To make your usage of `d2l-input-color` accessible, use the following properties when applicable:
60+
At its core, the color input is a button, so it relies on standard button semantics and adheres to [W3C's Button Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button) to ensure a smooth experience for all assistive technologies, but there are a few interesting details to note:
6161

62-
| Attribute | Description |
63-
|---|---|
64-
| `label` | **REQUIRED** when type is `custom`. [Acts as a primary label for the button](https://www.w3.org/WAI/tutorials/forms/labels/). Visible unless `label-hidden` is also used. |
65-
| `label-hidden` | Use if label should be visually hidden. |
62+
* `label` is required if `type` is `custom`, since it acts as a primary label for the button
63+
* However, if `type` is set to `background` or `foreground` a simple default will be used if `label` is left empty
64+
* `label-hidden` can be used to hide the label when there is sufficient visual context for sighted users; the label will remain available to screen reader users who may lack the visual context
65+
* `associated-value` allows you to set a hex color against which the input's color contrast will be measured, which ensures end users will get appropriate warnings if they choose inaccessible color combinations
66+
* The color input remains focusable even when `disabled` or in `read-only` mode, so that users can access the tooltip giving the current value

components/inputs/input-color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class InputColor extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(F
9191
static get properties() {
9292
return {
9393
/**
94-
* Value of an associated color as a HEX which will be used for color contrast analysis
94+
* ACCESSIBILITY: Value of an associated color as a HEX which will be used for color contrast analysis
9595
* @type {string}
9696
*/
9797
associatedValue: { attribute: 'associated-value', type: String },
@@ -106,7 +106,7 @@ class InputColor extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(F
106106
*/
107107
disallowNone: { attribute: 'disallow-none', type: Boolean },
108108
/**
109-
* REQUIRED: Label for the input, comes with a default value for background & foreground types.
109+
* ACCESSIBILITY: REQUIRED: Label for the input, comes with a default value for background & foreground types.
110110
* @type {string}
111111
*/
112112
label: {

0 commit comments

Comments
 (0)