Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/two-lobsters-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/dropdown": major
---

Fixed the bug: isDisabled does not disable dropdown
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 @@ -119,15 +119,15 @@ export function useDropdown(props: UseDropdownProps) {
});

const getMenuTriggerProps: PropGetter = (
props = {},
originalProps = {},
_ref: Ref<any> | null | undefined = null,
) => {
// 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;

return {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is important here to use props.isDisabled so that the PopoverTrigger component can respect another isDisabled gets passed by the user. (Otherwise, the unit test is going to fail.)

...mergeProps(otherMenuTriggerProps, props),
...mergeProps(otherMenuTriggerProps, {isDisabled: props.isDisabled, originalProps}),
ref: mergeRefs(_ref, triggerRef),
};
};
Expand Down