Skip to content

Commit

Permalink
refactor(dropdown): pass onKeyDown to menu trigger and don't hardcode…
Browse files Browse the repository at this point in the history
… autoFocus
  • Loading branch information
wingkwong committed May 15, 2024
1 parent 0bf8da5 commit 2de66ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/components/dropdown/src/use-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function useDropdown(props: UseDropdownProps) {
) => {
// These props are not needed for the menu trigger since it is handled by the popover trigger.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const {onKeyDown, onPress, onPressStart, ...otherMenuTriggerProps} = menuTriggerProps;
const {onPress, onPressStart, ...otherMenuTriggerProps} = menuTriggerProps;

return {
...mergeProps(otherMenuTriggerProps, {isDisabled}, originalProps),
Expand All @@ -146,7 +146,7 @@ export function useDropdown(props: UseDropdownProps) {
onAction: () => onMenuAction(props?.closeOnSelect),
onClose: state.close,
}),
autoFocus: "first",
autoFocus: state.focusStrategy || true,
} as MenuProps;
};

Expand Down

0 comments on commit 2de66ad

Please sign in to comment.