Skip to content

Commit

Permalink
fix(components): isdisabled does not disable dropdown (#2435)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuri-sun committed Mar 3, 2024
1 parent 5528ccd commit 9b27da5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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 {
...mergeProps(otherMenuTriggerProps, props),
...mergeProps(otherMenuTriggerProps, {isDisabled: props.isDisabled, originalProps}),

This comment has been minimized.

Copy link
@toxsick

toxsick Mar 5, 2024

@kuri-sun I don't think this is correct, souldn't it be

...mergeProps(otherMenuTriggerProps, originalProps, {isDisabled: props.isDisabled}),
// or
...mergeProps(otherMenuTriggerProps, {isDisabled: props.isDisabled}, originalProps),

you seem to add a new prop originalProps here... My snapshot tests are failing because originalprops="[object Object]" are suddenly added to the rendered html.

cheers

This comment has been minimized.

Copy link
@kuri-sun

kuri-sun Mar 5, 2024

Author Member

Hi @toxsick! Thanks for the reply! This issue was handled by this issue.
Thanks! πŸ₯‡

ref: mergeRefs(_ref, triggerRef),
};
};
Expand Down

0 comments on commit 9b27da5

Please sign in to comment.