diff --git a/clayui.com/content/docs/css/utilities/markup-accessibility.md b/clayui.com/content/docs/css/utilities/markup-accessibility.md index 3354c2c9c2..c46a1efa23 100644 --- a/clayui.com/content/docs/css/utilities/markup-accessibility.md +++ b/clayui.com/content/docs/css/utilities/markup-accessibility.md @@ -10,6 +10,7 @@ title: 'Accessibility' - [C Prefers Reduced Motion](#css-c-prefers-reduced-motion) - [C Prefers Link Underline](#css-c-prefers-link-underline) - [C Prefers Letter Spacing 1](#css-c-prefers-letter-spacing-1) +- [C Prefers Focus](#css-c-prefers-focus) @@ -87,3 +88,21 @@ The class `c-prefers-expanded-text` expands all truncated text to be visible. + +## C Prefers Focus(#css-c-prefers-focus) + +The class `c-prefers-focus` should be added to the `body` element to show the focus outline on mouse click. This is an accessibility feature for users who prefer this style of navigation. + +Focus Visible is now supported in all major browsers. We have enabled it by default in Clay CSS. Using the mouse to click on links, buttons, checkboxes, and other elements no longer show the focus outline. The focus outline will be shown when interacting with elements via keyboard. + +
+ The focus ring will always show in Text and Select elements that use the `input` tag. It is assumed the user will be interacting with the input via the keyboard. +
+ +
+ To disable `:focus-visible`, set the Sass variable `$enable-focus-visible: false;`. +
+ +
+ +
diff --git a/clayui.com/static/js/docs-site.js b/clayui.com/static/js/docs-site.js index cda38c8f6c..385092441c 100644 --- a/clayui.com/static/js/docs-site.js +++ b/clayui.com/static/js/docs-site.js @@ -24,12 +24,18 @@ if (!Element.prototype.closest) { document.addEventListener('click', function(event) { var t = event.target; - var a = t.tagName === 'a' ? t : t.closest('a'); + var a = t.tagName === 'a' || t.tagName === 'button' ? t : t.closest('a') || t.closest('button'); if (a) { if (a.getAttribute('href') === '#1') { event.preventDefault(); } + + var dataToggle = a.getAttribute('data-toggle'); + + if (dataToggle && dataToggle.startsWith('c-prefers')) { + document.querySelector('body').classList.toggle(a.getAttribute('data-toggle')); + } } }); })(); diff --git a/packages/clay-breadcrumb/src/__tests__/__snapshots__/index.tsx.snap b/packages/clay-breadcrumb/src/__tests__/__snapshots__/index.tsx.snap index 3681da7eea..79dcfad618 100644 --- a/packages/clay-breadcrumb/src/__tests__/__snapshots__/index.tsx.snap +++ b/packages/clay-breadcrumb/src/__tests__/__snapshots__/index.tsx.snap @@ -9,7 +9,7 @@ exports[`ClayBreadcrumb calls callback when an item is clicked 1`] = `