diff --git a/.changeset/solid-turkeys-shop.md b/.changeset/solid-turkeys-shop.md new file mode 100644 index 00000000000..cbce371d3a4 --- /dev/null +++ b/.changeset/solid-turkeys-shop.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +SelectPanel: Remove `usingRemoveActiveDescendant` usage from component diff --git a/packages/react/src/SelectPanel/SelectPanel.tsx b/packages/react/src/SelectPanel/SelectPanel.tsx index 8fe2e158fed..cd99fc00bc2 100644 --- a/packages/react/src/SelectPanel/SelectPanel.tsx +++ b/packages/react/src/SelectPanel/SelectPanel.tsx @@ -216,7 +216,6 @@ function Panel({ const usingFullScreenOnNarrow = disableFullscreenOnNarrow ? false : featureFlagFullScreenOnNarrow const shouldOrderSelectedFirst = useFeatureFlag('primer_react_select_panel_order_selected_at_top') && showSelectedOptionsFirst - const usingRemoveActiveDescendant = useFeatureFlag('primer_react_select_panel_remove_active_descendant') // Single select modals work differently, they have an intermediate state where the user has selected an item but // has not yet confirmed the selection. This is the only time the user can cancel the selection. @@ -755,8 +754,10 @@ function Panel({ const hasModifier = event.ctrlKey || event.altKey || event.metaKey if (hasModifier) return - // skip if it's not a alphabet key - if (!isAlphabetKey(event.nativeEvent as KeyboardEvent)) return + // skip if it's not the forward slash or an alphabet key + if (event.key !== '/' && !isAlphabetKey(event.nativeEvent as KeyboardEvent)) { + return + } // if this is a typeahead event, don't propagate outside of menu event.stopPropagation() @@ -794,7 +795,7 @@ function Panel({ } : {}), } as React.CSSProperties, - onKeyDown: usingRemoveActiveDescendant ? preventBubbling(overlayProps?.onKeyDown) : overlayProps?.onKeyDown, + onKeyDown: preventBubbling(overlayProps?.onKeyDown), }} focusTrapSettings={focusTrapSettings} focusZoneSettings={focusZoneSettings}