Skip to content

Commit eb245e8

Browse files
fix(dropdown): Delay setting focus on first item to prevent inadvertent scroll (#11018)
1 parent c10a613 commit eb245e8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-core/src/components/Dropdown/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
127127
'li button:not(:disabled),li input:not(:disabled),li a:not([aria-disabled="true"])'
128128
);
129129
firstElement && (firstElement as HTMLElement).focus();
130-
}, 0);
130+
}, 10);
131131
}
132132

133133
// If the event is not on the toggle and onOpenChange callback is provided, close the menu

packages/react-core/src/components/Select/Select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const SelectBase: React.FunctionComponent<SelectProps & OUIAProps> = ({
132132
setTimeout(() => {
133133
const firstElement = menuRef?.current?.querySelector('li button:not(:disabled),li input:not(:disabled)');
134134
firstElement && (firstElement as HTMLElement).focus();
135-
}, 0);
135+
}, 10);
136136
}
137137

138138
// If the event is not on the toggle and onOpenChange callback is provided, close the menu

0 commit comments

Comments
 (0)