Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
SelectPanel: Add filter input label and description#3312
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1d68feec60e57365e34a7a546be0f50ad4a5df167af1a6afdcf4c84eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@primer/react": patch | ||
| --- | ||
| SelectPanel: Add filter input label and description |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -10,6 +10,7 @@ import {TextInputProps} from '../TextInput' | ||
| import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate' | ||
| import {AnchoredOverlayWrapperAnchorProps} from '../AnchoredOverlay/AnchoredOverlay' | ||
| import {useProvidedRefOrCreate} from '../hooks' | ||
| import {SearchIcon} from '@primer/octicons-react' | ||
| interface SelectPanelSingleSelection { | ||
| selected: ItemInput | undefined | ||
| @@ -27,6 +28,8 @@ interface SelectPanelBaseProps { | ||
| gesture: 'anchor-click' | 'anchor-key-press' | 'click-outside' | 'escape' | 'selection', | ||
| ) => void | ||
| placeholder?: string | ||
| // TODO: Make `inputLabel` required in next major version | ||
| inputLabel?: string | ||
| overlayProps?: Partial<OverlayProps> | ||
| } | ||
| @@ -53,6 +56,8 @@ export function SelectPanel({ | ||
| renderAnchor = props => <DropdownButton {...props} />, | ||
| anchorRef: externalAnchorRef, | ||
| placeholder, | ||
| placeholderText = 'Filter items', | ||
| inputLabel = placeholderText, | ||
| selected, | ||
| onSelectedChange, | ||
| filterValue: externalFilterValue, | ||
| @@ -141,9 +146,11 @@ export function SelectPanel({ | ||
| return { | ||
| sx: {m: 2}, | ||
| contrast: true, | ||
| leadingVisual: SearchIcon, | ||
| 'aria-label': inputLabel, | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say it doesn't matter as much as they both will announce the same. I'd say one benefit that you could potentially gain with a visually hidden label and | ||
| ...textInputProps, | ||
| } | ||
| }, [textInputProps]) | ||
| }, [inputLabel, textInputProps]) | ||
| return ( | ||
| <AnchoredOverlay | ||
| @@ -159,6 +166,7 @@ export function SelectPanel({ | ||
| <FilteredActionList | ||
| filterValue={filterValue} | ||
| onFilterChange={onFilterChange} | ||
| placeholderText={placeholderText} | ||
| {...listProps} | ||
| role="listbox" | ||
| aria-multiselectable={isMultiSelectVariant(selected) ? 'true' : 'false'} | ||
Uh oh!
There was an error while loading. Please reload this page.