nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
20.45k stars 1.24k forks source link

[BUG] - Cannot use up/down arrow keys in Textarea rendered in Accordion #2152

Open tuxracer opened 6 months ago

tuxracer commented 6 months ago

NextUI Version

2.2.9

Describe the bug

If a Textarea component is rendered as a child of an AccordionItem a user is unable to use up/down arrow keys in the Textarea

Your Example Website or App

https://codesandbox.io/p/devbox/sharp-wildflower-knr8fv?file=%2FApp.jsx%3A17%2C5

Steps to Reproduce the Bug or Issue

export default function App() {
  return (
    <Accordion>
      <AccordionItem key="1" title="Accordion 1">
        <Textarea />
      </AccordionItem>
    </Accordion>
  );
}

Expected behavior

A user should be able to use up/down arrow keys to move their text cursor inside the Textarea

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

itsEricWu commented 6 months ago

I also have this issue in another scenario.

When having Input inside the AccordionItem component, the use of the "white space key" (Spacebar) triggers the event listener assigned to the accordion itself, rather than allowing for standard text input in fields within the accordion.

saguirre commented 6 months ago

Same issue attempting to use an Input component inside a Dropdown component. Tried several workarounds with onKeyPress and onChange but no luck.

tuxracer commented 6 months ago

FYI this workaround is working for me https://github.com/nextui-org/nextui/issues/1608#issuecomment-1839930967