-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Aria Live Configuration #4414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Aria Live Configuration #4414
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5bf8f67
aira-live branch changes applied to react-select branch v4.0.2
ebonow 7b7e413
Update custom aria message example
ebonow 36ba1d3
Add test coverage for accessilibity when isMulti
ebonow 2baf5a9
Refactor to move all accessibility functionality to new LiveRegion c…
ebonow 57a9f65
Minor clean-up of comments
ebonow 02e788a
selected may be null onClear
ebonow aef1b8a
Merge branch 'master' into aria-messages-v4
ebonow 335ca17
Update caniuse-lite browserlist
ebonow 12a18e7
Render single context node, add recommended attributes per #3353
ebonow f5fe8f9
Do not add mention options count if menuIsClosed per issue #4411
ebonow 9801a7f
Announce menu option is selected if focused, add tests. Resolves issu…
ebonow 7efc106
search for option in selectValue
ebonow 258dde1
Add aria-live prop to customize attribute on LiveRegion
ebonow 4fb7988
update snapshots
ebonow 7e588e5
export defaultAriaLiveMessages as object
ebonow e5f6f93
switch to useMemo instead of useState and get some props from selectP…
ebonow cb21926
Refactor formatting functions to have one object prop, add prop comments
ebonow 6585829
Fix props typo
ebonow 77b61f3
rollback lockfile
ebonow f4aaf24
Merge branch 'master' into aria-messages-v4
JedWatson 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@react-select/docs': minor | ||
'react-select': minor | ||
--- | ||
|
||
Add ariaLiveMessages prop for internationalization and other customizations |
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,58 @@ | ||
// @flow | ||
import React, { useState } from 'react'; | ||
|
||
import Select from 'react-select'; | ||
import { colourOptions } from '../data'; | ||
|
||
export default function CustomAriaLive() { | ||
const [ariaFocusMessage, setAriaFocusMessage] = useState(''); | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
|
||
const style = { | ||
blockquote: { | ||
fontStyle: 'italic', | ||
fontSize: '.75rem', | ||
margin: '1rem 0', | ||
}, | ||
label: { | ||
fontSize: '.75rem', | ||
fontWeight: 'bold', | ||
lineHeight: 2, | ||
}, | ||
}; | ||
|
||
const onFocus = ({ focused, isDisabled }) => { | ||
const msg = `You are currently focused on option ${focused.label}${ | ||
isDisabled ? ', disabled' : '' | ||
}`; | ||
setAriaFocusMessage(msg); | ||
return msg; | ||
}; | ||
|
||
const onMenuOpen = () => setIsMenuOpen(true); | ||
const onMenuClose = () => setIsMenuOpen(false); | ||
|
||
return ( | ||
<form> | ||
<label style={style.label} id="aria-label" htmlFor="aria-example-input"> | ||
Select a color | ||
</label> | ||
|
||
{!!ariaFocusMessage && !!isMenuOpen && ( | ||
<blockquote style={style.blockquote}>"{ariaFocusMessage}"</blockquote> | ||
)} | ||
|
||
<Select | ||
aria-labelledby="aria-label" | ||
ariaLiveMessages={{ | ||
onFocus, | ||
}} | ||
inputId="aria-example-input" | ||
name="aria-live-color" | ||
onMenuOpen={onMenuOpen} | ||
onMenuClose={onMenuClose} | ||
options={colourOptions} | ||
/> | ||
</form> | ||
); | ||
} |
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
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.
Uh oh!
There was an error while loading. Please reload this page.