From cd172ede8c284acdb1419337b93b0cbc4679bd73 Mon Sep 17 00:00:00 2001 From: Lea Verou Date: Thu, 19 Dec 2024 21:15:25 -0500 Subject: [PATCH] Docs for visually hidden util, remove visually hidden component per #232 --- docs/docs/components/button-group.md | 2 +- docs/docs/components/visually-hidden.md | 46 --------- docs/docs/experimental/themer.md | 26 +++-- docs/docs/resources/changelog.md | 4 +- docs/docs/utilities/visually-hidden.md | 96 +++++++++++++++++++ src/components/color-picker/color-picker.ts | 4 +- src/components/copy-button/copy-button.ts | 6 +- src/components/page/page.css | 13 --- src/components/page/page.ts | 5 +- .../visually-hidden/visually-hidden.css | 11 --- .../visually-hidden/visually-hidden.test.ts | 43 --------- .../visually-hidden/visually-hidden.ts | 27 ------ 12 files changed, 119 insertions(+), 164 deletions(-) delete mode 100644 docs/docs/components/visually-hidden.md create mode 100644 docs/docs/utilities/visually-hidden.md delete mode 100644 src/components/visually-hidden/visually-hidden.css delete mode 100644 src/components/visually-hidden/visually-hidden.test.ts delete mode 100644 src/components/visually-hidden/visually-hidden.ts diff --git a/docs/docs/components/button-group.md b/docs/docs/components/button-group.md index f45f06691..73043ea6f 100644 --- a/docs/docs/components/button-group.md +++ b/docs/docs/components/button-group.md @@ -167,7 +167,7 @@ Create a split button using a button and a dropdown. Use a [visually hidden](/do Save - More options + Save diff --git a/docs/docs/components/visually-hidden.md b/docs/docs/components/visually-hidden.md deleted file mode 100644 index 4542c6b89..000000000 --- a/docs/docs/components/visually-hidden.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Visually Hidden -description: The visually hidden utility makes content accessible to assistive devices without displaying it on the screen. -tags: component -noAlpha: true ---- - -According to [The A11Y Project](https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/), "there are real world situations where visually hiding content may be appropriate, while the content should remain available to assistive technologies, such as screen readers. For instance, hiding a search field's label as a common magnifying glass icon is used in its stead." - -Since visually hidden content can receive focus when tabbing, the element will become visible when something inside receives focus. This behavior is intentional, as sighted keyboard user won't be able to determine where the focus indicator is without it. - -```html {.example} -
- - Skip to main content - -
-``` - -## Examples - -### Links That Open in New Windows - -In this example, the link will open a new window. Screen readers will announce "opens in a new window" even though the text content isn't visible to sighted users. - -```html {.example} - - Visit External Page - - opens in a new window - -``` - -### Content Conveyed By Context - -Adding a label may seem redundant at times, but they're very helpful for unsighted users. Rather than omit them, you can provide context to unsighted users with visually hidden content that will be announced by assistive devices such as screen readers. - -```html {.example} - -
- Personal Info -
- - -
-``` diff --git a/docs/docs/experimental/themer.md b/docs/docs/experimental/themer.md index e1b415ebe..a334d7068 100644 --- a/docs/docs/experimental/themer.md +++ b/docs/docs/experimental/themer.md @@ -379,12 +379,8 @@ hasOutline: false background-color: var(--wa-color-neutral-fill-quiet); } - /** - , but without the :not(:focus-within), - the reason is that it shows the default browser file uploader. -*/ - .hidden-label::part(form-control-label), - .file-uploader input { + /** Visually hidden */ + .hidden-label::part(form-control-label) { position: absolute !important; width: 1px !important; height: 1px !important; @@ -522,7 +518,7 @@ hasOutline: false
-