[BUG] - DropdownItem onPress not working
NextUI Version
2.3.0
Describe the bug
After the update, when trying to click on a DropdownItem using the onPress click handler, nothing happens. The dropdown just closes. If I disable closeOnSelect for both the Dropdown and DropdownItem and then try and use the onPress handler it works as intended.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Add items to a
Dropdown - Add
onPresshandler toDropdownIteminside the dropdown - Click on the dropdown Item
- Dropdown will close without action inside the
onPressdoes anything
Expected behavior
Expect the onPress action to complete when clicking on the DropdownItem
Screenshots or Videos
No response
Operating System Version
Any
Browser
Chrome
I also have this issue, not only in the dropdown some others component also that have onPress action dont work
Hey guys, we're currently looking into this issue, please use the onAction in the meantime
e.g.
https://stackblitz.com/edit/vitejs-vite-sell4f?file=src%2FApp.tsx
@daniel-esserweb could you please tell us on which other components the onPress is not working?
@jrgarciadev I've tested with console.log & Server Actions on onPress & onClick, both of which don't seem to work in the current version. Tested v2.2.10 and both event handlers work as expected.
Same issues here, I don't why it stop functioning at some point.
As per @jrgarciadev
Hey guys, we're currently looking into this issue, please use the
onActionin the meantimee.g.
https://stackblitz.com/edit/vitejs-vite-sell4f?file=src%2FApp.tsx
I'm resorted to use switch-case on the key to trigger different actions
const onAction = (key: Key) => {
switch (key) {
case "edit":
// Handle edit action
break;
case "view":
router.push(`/tasks/${task.id}`);
break;
case "delete":
showConfirmModal();
break;
default:
break;
}
};
Note: Need to make sure every dropdown-item has a unique key