themesberg / themesberg/flowbite-react

Dropdown: "disabled" attribute does not work when "renderTrigger"

Open
#1,528 1 comment 1 reaction 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

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

Steps to reproduce

I would want to have a custom span button, with dropdown attached.
Try this code:

return (
      <Dropdown label="Dropdown button" disabled={true} renderTrigger={() => 
      <span>[Custom Button]</span>

      }>
        <Dropdown.Item>Dashboard</Dropdown.Item>
        <Dropdown.Item>Settings</Dropdown.Item>
        <Dropdown.Item>Earnings</Dropdown.Item>
        <Dropdown.Item>Sign out</Dropdown.Item>
      </Dropdown>
    );

Current behavior

In case disabled = {true}, the dropdown still appears when clicking.

Expected behavior

In case disabled = {true}, the dropdown should not appear.

Context

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 at the Dropdown component's renderTrigger path and reproduce the issue with the provided disabled={true} example. Trace how clicks on the custom span are handled and verify that the dropdown does not appear when disabled is true.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.