File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
packages/react/src/FilteredActionList Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @primer/react " : patch
3+ ---
4+
5+ Fix an issue in useAnnouncements.tsx causing a TypeError in production. The activeItem variable may be null.
Original file line number Diff line number Diff line change 44import { announce } from '@primer/live-region-element'
55import { useEffect , useRef } from 'react'
66import type { FilteredActionListProps } from './FilteredActionListEntry'
7+ import type { ItemInput } from '../deprecated/ActionList/List'
78
89// we add a delay so that it does not interrupt default screen reader announcement and queues after it
910const delayMs = 500
@@ -28,10 +29,10 @@ const getItemWithActiveDescendant = (
2829 const optionElements = listElement . querySelectorAll ( '[role="option"]' )
2930
3031 const index = Array . from ( optionElements ) . indexOf ( activeItemElement )
31- const activeItem = items [ index ]
32+ const activeItem = items [ index ] as ItemInput | undefined
3233
33- const text = activeItem . text
34- const selected = activeItem . selected
34+ const text = activeItem ? .text
35+ const selected = activeItem ? .selected
3536
3637 return { index, text, selected}
3738}
You can’t perform that action at this time.
0 commit comments