Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input inside a dropdown is not working (can't type) #916

Closed
2 tasks done
0xMALVEE opened this issue Aug 18, 2023 · 7 comments · Fixed by #1237 or #1325
Closed
2 tasks done

Input inside a dropdown is not working (can't type) #916

0xMALVEE opened this issue Aug 18, 2023 · 7 comments · Fixed by #1237 or #1325
Labels
🐛 bug Something isn't working confirmed This bug was confirmed help wanted Extra attention is needed workaround Maybe a bug, but it has a workaround.
Milestone

Comments

@0xMALVEE
Copy link

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

Steps to reproduce

Code given bellow.

Current behavior

When I put a input inside the Dropdown header I can't type in that input box. But if I put it outside I can type. I can only increase using the up / down arrow in the right side of the input but I want to be able to type also.

Expected behavior

I should be able to type there. not only up/down arrow.

Context

So I have a dropdown and people can select area as numbers.
image

  <Dropdown className={styles.dropdown} label={'Area'}>
              <Dropdown.Header>
                <label htmlFor="purpose" className="block text-sm font-medium mb-2">
                  Area (sqft)
                </label>
                <div>
                  <div className="mb-2 block">
                    <Label htmlFor="minimum-area" value="Minimum sqft" />
                  </div>
                  <TextInput
                    id="minimum-area"
                    placeholder="Minimum sqft"
                    onChange={(e: any) => {
                      setMinArea(e.target.value as number)
                      console.log(e.target.value)
                    }}
                    value={minArea}
                    sizing="sm"
                    step={100}
                    min={0}
                    type="number"
                  />
                </div>
                <div>
                  <div className="mb-2 block">
                    <Label htmlFor="maximum-area" value="Maximum sqft" />
                  </div>
                  <TextInput
                    id="maximum-area"
                    onChange={(e: any) => setMaxArea(e.target.value as number)}
                    placeholder="Maximum sqft"
                    value={maxArea}
                    sizing="sm"
                    step={100}
                    min={0}
                    type="number"
                  />
                </div>
              </Dropdown.Header>
              <Dropdown.Item className="hover:bg-transparent">
                <div className="flex justify-between w-[100%] ">
                  <Button
                    onClick={(e: any) => {
                      setMinArea(0)
                      setMaxArea(500)
                    }}
                    className="w-[46%]"
                  >
                    Reset
                  </Button>
                  <Button className="w-[46%]">Done</Button>
                </div>
              </Dropdown.Item>
            </Dropdown>
@ivoneijr
Copy link

ivoneijr commented Aug 19, 2023

Very similar issue here...

In my case, I have a component inside Dropdown.Item with its own state management, but changing this component state just doesn't work 🤡

I had to use Headlessui for dropdowns...

@tulup-conner
Copy link
Collaborator

Hi there, this combination of components is definitely not a use case I was aware of!

We use a third-party library called Floating UI to manage most of the logic in the Dropdown so I'm inclined that this is an issue with focus trap being controlled by our usage of Floating UI.

Your usage seems reasonable here so it definitely should work. Thanks for submitting this. We can take a look at this, but definitely feel free to try and contribute if you have the time - it would speed things along. The file in question is Dropdown.tsx.

@tulup-conner tulup-conner added 🐛 bug Something isn't working confirmed This bug was confirmed help wanted Extra attention is needed labels Aug 21, 2023
@tulup-conner tulup-conner added this to the 1.0.0 milestone Aug 21, 2023
ChrisCoastal added a commit to ChrisCoastal/flowbite-react that referenced this issue Aug 29, 2023
useTypeahead causing unexpected behaviour in Dropdowns that expect keyboard input; some keyboard
events will not propogate

'fix themesberg#916'
@ChrisCoastal ChrisCoastal mentioned this issue Aug 29, 2023
1 task
@ChrisCoastal
Copy link

The issue seems to be related to Floating UI as you said. The opened pull request should do the trick.

@rluders
Copy link
Collaborator

rluders commented Aug 29, 2023

Folks, check the discussion at #941 - it seems that there is a misunderstanding related to the Dropdown and Popover components.

@evrrnv
Copy link

evrrnv commented Sep 21, 2023

Same, I'm still having this issue.

@eyqs
Copy link

eyqs commented Oct 11, 2023

Having this issue as well. Please let us know if there are any updates!

@xdmaury
Copy link

xdmaury commented Oct 27, 2023

I am using onKeyDown={(e) => e.stopPropagation()}.

Screenshot 2023-10-27 at 15 13 51

Screenshot 2023-10-27 at 15 13 33

@rluders rluders added the workaround Maybe a bug, but it has a workaround. label Nov 1, 2023
nigellima added a commit to gistia/flowbite-react that referenced this issue Jan 21, 2024
This PR creates the Popover component based on the specs of the core library

fix themesberg#916 fix themesberg#878
SutuSebastian pushed a commit that referenced this issue Jan 23, 2024
* feat(popover): created Popover component

This PR creates the Popover component based on the specs of the core library

fix #916 fix #878

* docs(popover): created document page of Popover component with examples

* refact(popover): removed unnecessary code

* docs(popover): improved documentation

* fix(popover): import correct theme props

* refact(popover): use relative imports

* docs(popover): reverted import paths
abdulbasithqb pushed a commit to abdulbasithqb/flowbite-react that referenced this issue Jan 31, 2024
* feat(popover): created Popover component

This PR creates the Popover component based on the specs of the core library

fix themesberg#916 fix themesberg#878

* docs(popover): created document page of Popover component with examples

* refact(popover): removed unnecessary code

* docs(popover): improved documentation

* fix(popover): import correct theme props

* refact(popover): use relative imports

* docs(popover): reverted import paths
abdulbasithqb pushed a commit to abdulbasithqb/flowbite-react that referenced this issue Jan 31, 2024
* feat(popover): created Popover component

This PR creates the Popover component based on the specs of the core library

fix themesberg#916 fix themesberg#878

* docs(popover): created document page of Popover component with examples

* refact(popover): removed unnecessary code

* docs(popover): improved documentation

* fix(popover): import correct theme props

* refact(popover): use relative imports

* docs(popover): reverted import paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working confirmed This bug was confirmed help wanted Extra attention is needed workaround Maybe a bug, but it has a workaround.
Projects
None yet
8 participants