-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tab-index-as-number-type
- Loading branch information
Showing
23 changed files
with
889 additions
and
375 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
'react-select': minor | ||
--- | ||
|
||
Use accessor props to get value and label in `compareOption` |
This file contains 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,5 @@ | ||
--- | ||
'react-select': patch | ||
--- | ||
|
||
Set event listeners to be non-passive to remove Chrome console warnings |
This file contains 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,7 @@ | ||
--- | ||
'react-select': patch | ||
--- | ||
|
||
Memoize stripDiacritics in createFilter for the input with memoize-one so that stripDiacritics is not called for the same string as many times as there are options every time the input changes | ||
|
||
Inspired by https://blog.johnnyreilly.com/2019/04/react-select-with-less-typing-lag.html |
This file contains 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 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 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 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 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 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.