From 349b8d4fb39171c4525c6001b11c2b12a697e0a8 Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Tue, 23 May 2023 11:34:24 -0700 Subject: [PATCH 1/3] SelectPanel: Announce filter changes to screenreaders --- src/SelectPanel/SelectPanel.tsx | 75 +++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/src/SelectPanel/SelectPanel.tsx b/src/SelectPanel/SelectPanel.tsx index b8604f0a344..a0eadfffb0a 100644 --- a/src/SelectPanel/SelectPanel.tsx +++ b/src/SelectPanel/SelectPanel.tsx @@ -1,15 +1,16 @@ import React, {useCallback, useMemo} from 'react' +import {AnchoredOverlay, AnchoredOverlayProps} from '../AnchoredOverlay' +import {AnchoredOverlayWrapperAnchorProps} from '../AnchoredOverlay/AnchoredOverlay' import {FilteredActionList, FilteredActionListProps} from '../FilteredActionList' import {OverlayProps} from '../Overlay' +import {TextInputProps} from '../TextInput' +import {ItemProps} from '../deprecated/ActionList' import {ItemInput} from '../deprecated/ActionList/List' -import {FocusZoneHookSettings} from '../hooks/useFocusZone' import {DropdownButton} from '../deprecated/DropdownMenu' -import {ItemProps} from '../deprecated/ActionList' -import {AnchoredOverlay, AnchoredOverlayProps} from '../AnchoredOverlay' -import {TextInputProps} from '../TextInput' -import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate' -import {AnchoredOverlayWrapperAnchorProps} from '../AnchoredOverlay/AnchoredOverlay' import {useProvidedRefOrCreate} from '../hooks' +import {FocusZoneHookSettings} from '../hooks/useFocusZone' +import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate' +import {LiveRegion, LiveRegionOutlet, Message} from '../internal/components/LiveRegion' interface SelectPanelSingleSelection { selected: ItemInput | undefined @@ -146,31 +147,43 @@ export function SelectPanel({ }, [textInputProps]) return ( - - - + + + + + + + ) } From bf1c3652d517a62b610afed5a9cd6955588a775e Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Tue, 23 May 2023 11:39:33 -0700 Subject: [PATCH 2/3] Create rare-humans-watch.md --- .changeset/rare-humans-watch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rare-humans-watch.md diff --git a/.changeset/rare-humans-watch.md b/.changeset/rare-humans-watch.md new file mode 100644 index 00000000000..631fa45936a --- /dev/null +++ b/.changeset/rare-humans-watch.md @@ -0,0 +1,5 @@ +--- +"@primer/react": patch +--- + +SelectPanel: Announce changes to screen readers From 2d360707beb8af4f270cdbea662f278f432eaefd Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Wed, 24 May 2023 11:35:46 -0700 Subject: [PATCH 3/3] Update formatting --- src/SelectPanel/SelectPanel.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SelectPanel/SelectPanel.tsx b/src/SelectPanel/SelectPanel.tsx index 440a23b59c1..dfcac4cdd97 100644 --- a/src/SelectPanel/SelectPanel.tsx +++ b/src/SelectPanel/SelectPanel.tsx @@ -1,7 +1,8 @@ -import {useId} from '../hooks/useId' +import {SearchIcon} from '@primer/octicons-react' import React, {useCallback, useMemo} from 'react' import {AnchoredOverlay, AnchoredOverlayProps} from '../AnchoredOverlay' import {AnchoredOverlayWrapperAnchorProps} from '../AnchoredOverlay/AnchoredOverlay' +import Box from '../Box' import {FilteredActionList, FilteredActionListProps} from '../FilteredActionList' import Heading from '../Heading' import {OverlayProps} from '../Overlay' @@ -11,9 +12,9 @@ import {ItemInput} from '../deprecated/ActionList/List' import {DropdownButton} from '../deprecated/DropdownMenu' import {useProvidedRefOrCreate} from '../hooks' import {FocusZoneHookSettings} from '../hooks/useFocusZone' +import {useId} from '../hooks/useId' import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate' import {LiveRegion, LiveRegionOutlet, Message} from '../internal/components/LiveRegion' -import {SearchIcon} from '@primer/octicons-react' interface SelectPanelSingleSelection { selected: ItemInput | undefined @@ -178,7 +179,7 @@ export function SelectPanel({ ? 'Showing all items' : items.length <= 0 ? 'No matching items' - : `${items.length} matching ${items.length === 1 ? 'item' : 'items'} + : `${items.length} matching ${items.length === 1 ? 'item' : 'items'}` } />