diff --git a/examples/unit-testing/dropdown.test.js b/examples/unit-testing/dropdown.test.js index b0d2b07..412bb53 100644 --- a/examples/unit-testing/dropdown.test.js +++ b/examples/unit-testing/dropdown.test.js @@ -12,10 +12,28 @@ describe(`Dropdown`, () => { expect(text).toBeInTheDocument() }) - it(`renders a focusable activator element`, () => { + it(`renders a focusable button that activates the dropdown`, () => { + const activatorText = `Dogs` + const items = [{ + text: 'item 1', + url: '#' + }, { + text: 'item 2', + url: '#' + }] + const dropdown = render() - }) - it(`sends focus to dropdown content when active`, () => { + const activator = dropdown.getByTestId('dropdown-activator') + activator.focus() + + expect(activator).toHaveFocus() + + fireEvent.click(activator) + + const dropdownList = dropdown.getByTestId('dropdown-itemList') + const firstAnchor = dropdownList.querySelector('a') + expect(firstAnchor).toHaveFocus() + }) }) diff --git a/src/components/site-chrome/layout.scss b/src/components/site-chrome/layout.scss index 7d97243..c8203bf 100644 --- a/src/components/site-chrome/layout.scss +++ b/src/components/site-chrome/layout.scss @@ -21,7 +21,7 @@ body { a, a:link, a:visited { color: #333; } -.js-focus-visible :focus { +.js-focus-visible :focus:not(.focus-visible) { outline: none; } .js-focus-visible :focus-visible { diff --git a/src/slides/index.mdx b/src/slides/index.mdx index f90cc34..223990e 100644 --- a/src/slides/index.mdx +++ b/src/slides/index.mdx @@ -79,6 +79,7 @@ http://bit.ly/microsoft-inclusive-toolkit - Accessibility debugging - Accessibility in JavaScript apps - Focus management + - Client-side routing - Announcements - Semantic HTML - Unobtrusive motion