themesberg / themesberg/flowbite-react

OnToggle on Dropdown does not trigger

Open
#1,617 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

  1. Create a client component with Next.js.
  2. Add the Flowbite dropdown and pass an onToggle or onClick function like this:
<FlowbiteDropdown
            onClick={() => console.log('cliock')}
            onToggle={(e) => console.log('toggle', e)}
            label="test"
          >
            <DropdownItem>test123</DropdownItem>
          </FlowbiteDropdown>

Current behavior

The event callbacks are not triggered.

Expected behavior

The console log appears.

Context

I want to create a basic useState hook to know programmatically whether the dropdown is open or not.

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.

Research direction

Start by reproducing the issue with a Next.js client component using FlowbiteDropdown and DropdownItem, passing both onClick and onToggle as shown. Trace the dropdown entry point and callback handling, then verify that opening the dropdown and clicking it produce the expected console logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.