This repository was archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
fix(carousel): pagination carousel - accessibility improvements #2278
Open
kolaps33
wants to merge
19
commits into
master
Choose a base branch
from
mituron/carousel-app-mode-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
757ce6d
fixes for carousel with pagination
mituron c979062
adding tests for carousel item behavior
mituron 1cb3a01
fix some lint issue
mituron 0104d59
prettier
mituron 3639ce7
adding aria label as prop
mituron 8027a40
Merge branch 'master' into mituron/carousel-app-mode-fix
kolaps33 9ea3d70
adding logic for adding region/group differently based on carousel type
mituron d25bbca
improving documentation
mituron 0d8fe8d
adresing changes from review
mituron 4c8063e
change of do description
mituron 6993079
fix lint issues
mituron 14730c8
another lint fix
mituron 12b94e5
apply prettier
mituron fc6abda
merging with latest master
mituron 553cbbe
Revert "merging with latest master"
mituron 7cdfd95
merge with latest master
mituron b113e78
fix based on review, stop animation - fix for narration
mituron a5a4ac4
disable navigation for VC adding role none
mituron 75a3e55
fix for stealing focus when rotating with arrow keys on carousel item…
mituron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
packages/accessibility/test/behaviors/caroselBehavior-test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { carouselBehavior } from '@fluentui/accessibility' | ||
|
||
const roleDescription = 'carousel' | ||
const label = 'portrait collection' | ||
|
||
describe('carouselBehavior.ts', () => { | ||
describe('root', () => { | ||
test(`sets "role=region" when carousel has NO navigation`, () => { | ||
const expectedResult = carouselBehavior({ ariaLiveOn: false, navigation: false }) | ||
expect(expectedResult.attributes.root.role).toEqual('region') | ||
}) | ||
|
||
test('sets "aria-roledescription" when carousel has NO navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: false, | ||
ariaRoleDescription: roleDescription, | ||
}) | ||
expect(expectedResult.attributes.root['aria-roledescription']).toEqual(roleDescription) | ||
}) | ||
|
||
test('sets "aria-label" when carousel has NO navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: false, | ||
ariaLabel: label, | ||
}) | ||
expect(expectedResult.attributes.root['aria-label']).toEqual(label) | ||
}) | ||
|
||
test('do NOT set "aria-roledescription" when carousel has navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: true, | ||
ariaRoleDescription: roleDescription, | ||
}) | ||
expect(expectedResult.attributes.root['aria-roledescription']).toBeUndefined() | ||
}) | ||
|
||
test('do NOT set "aria-label" when carousel has navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: true, | ||
ariaLabel: label, | ||
}) | ||
expect(expectedResult.attributes.root['aria-label']).toBeUndefined() | ||
}) | ||
|
||
test(`do NOT set "role=region" when carousel has navigation`, () => { | ||
const expectedResult = carouselBehavior({ ariaLiveOn: false, navigation: true }) | ||
expect(expectedResult.attributes.root.role).toBeUndefined() | ||
}) | ||
}) | ||
|
||
describe('itemsContainer', () => { | ||
test('sets "aria-roledescription" when carousel has navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: true, | ||
ariaRoleDescription: roleDescription, | ||
}) | ||
expect(expectedResult.attributes.itemsContainer['aria-roledescription']).toEqual( | ||
roleDescription, | ||
) | ||
}) | ||
|
||
test('sets "aria-label" when carousel has navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: true, | ||
ariaLabel: label, | ||
}) | ||
expect(expectedResult.attributes.itemsContainer['aria-label']).toEqual(label) | ||
}) | ||
|
||
test('do NOT set "aria-roledescription" when carousel has NO navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: false, | ||
ariaRoleDescription: roleDescription, | ||
}) | ||
expect(expectedResult.attributes.itemsContainer['aria-roledescription']).toBeUndefined() | ||
}) | ||
|
||
test('do NOT set "aria-label" when carousel has NO navigation', () => { | ||
const expectedResult = carouselBehavior({ | ||
ariaLiveOn: false, | ||
navigation: false, | ||
ariaLabel: label, | ||
}) | ||
expect(expectedResult.attributes.itemsContainer['aria-label']).toBeUndefined() | ||
}) | ||
|
||
test(`do NOT set "role=group" when carousel has NO navigation`, () => { | ||
const expectedResult = carouselBehavior({ ariaLiveOn: false, navigation: false }) | ||
expect(expectedResult.attributes.itemsContainer.role).toBeUndefined() | ||
}) | ||
}) | ||
}) |
23 changes: 23 additions & 0 deletions
23
packages/accessibility/test/behaviors/caroseltemBehavior-test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { carouselItemBehavior } from '@fluentui/accessibility' | ||
|
||
describe('carouselItemBehavior.ts', () => { | ||
test('sets tabIndex="0" on root when carousel has navigation and item is visible ', () => { | ||
const expectedResult = carouselItemBehavior({ navigation: true, active: true }) | ||
expect(expectedResult.attributes.root.tabIndex).toEqual(0) | ||
}) | ||
|
||
test('sets tabIndex="-1" on root when carousel has navigation and item is NOT visible ', () => { | ||
const expectedResult = carouselItemBehavior({ navigation: true, active: false }) | ||
expect(expectedResult.attributes.root.tabIndex).toEqual(-1) | ||
}) | ||
|
||
test('sets tabIndex="-1" on root when carousel has NO navigation and item is visible', () => { | ||
const expectedResult = carouselItemBehavior({ navigation: false, active: true }) | ||
expect(expectedResult.attributes.root.tabIndex).toEqual(-1) | ||
}) | ||
|
||
test('sets tabIndex="-1" on root when carousel has NO navigation and item is NOT visible', () => { | ||
const expectedResult = carouselItemBehavior({ navigation: false, active: false }) | ||
expect(expectedResult.attributes.root.tabIndex).toEqual(-1) | ||
}) | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as above here.