themesberg / themesberg/flowbite-react

Event object isn't correctly passed to Dropdown.Item click handler

Open
#1,440 0 comments 1 reaction 1 assignee View on GitHub

@SutuSebastian is already working on this.

Since Jun 27, 2024.

:bug: bug confirmed
Dominant language
TypeScript
Stars
2.1k
Forks
506
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
The event object isn't properly passed to the Dropdown.Item onClick prop which leads to undefined when logged.

To Reproduce
Steps to reproduce the behavior:

  1. Add a Dropdown component
  2. Add a click handler function to Dropdown.Item's onClick prop
  3. Try logging e or event
  4. See error

Expected behavior
I expected to be able to access the e prop within the handler function and console.log the event object like so:
image

But unfortunately it logs out undefined.

Strangely, by removing the e prop and simply console.loging the event keyword I am able to access the event object, though my IDE marks it as deprecated:

image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 121.0.6167.184 (Official Build) (arm64)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.