File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -280,6 +280,20 @@ describe('MenuContainer', () => {
280280 expect ( firstItem ) . toHaveFocus ( ) ;
281281 } ) ;
282282
283+ it ( 'does not focus default value on click' , async ( ) => {
284+ const { getByTestId, getByText } = render (
285+ < TestMenu items = { ITEMS } defaultFocusedValue = "plant-04" />
286+ ) ;
287+ const trigger = getByTestId ( 'trigger' ) ;
288+ const item = getByText ( 'Succulent' ) ;
289+
290+ await act ( async ( ) => {
291+ await user . click ( trigger ) ;
292+ } ) ;
293+
294+ expect ( item ) . not . toHaveFocus ( ) ;
295+ } ) ;
296+
283297 it ( 'focuses defaultFocusedValue on ArrowDown keydown' , async ( ) => {
284298 const { getByText, getByTestId } = render (
285299 < TestMenu items = { ITEMS } defaultFocusedValue = "plant-04" />
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export const useMenu = <T extends HTMLElement = HTMLElement, M extends HTMLEleme
9797 const focusTriggerRef = useRef < boolean > ( false ) ;
9898
9999 const [ state , dispatch ] = useReducer ( stateReducer , {
100- focusedValue : focusedValue || defaultFocusedValue ,
100+ focusedValue,
101101 isExpanded : isExpanded || defaultExpanded ,
102102 selectedItems : initialSelectedItems ,
103103 valuesRef : values ,
You can’t perform that action at this time.
0 commit comments