formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
97 stars 3 forks source link

Text field within MenuItem does not register " " (space) input. #266

Open ForrestCogna opened 6 days ago

ForrestCogna commented 6 days ago

Describe the bug Placing a TextField within MenuItem component prevents spaces from being registered. Example: "My text input" displays: "Mytextinput".

To Reproduce Create an isolated reproduction on the CodeSandbox: Isolated reproduction on Codesandbox

Expected behavior TextInput should register spaces even inside a MenuItem component

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context There is a workaround via:

<TextField
 inputAttributes={{
   onKeyDown: (e) => {
       if (e.key === ' ') {
         e.preventDefault()
         setValue((prev) => prev + ' ')
       }
    }
/>
blvdmitry commented 6 days ago

That's an interesting use case. I think it ignores the space since space key would also trigger the button click. I'll see what we can do there to make sure it also doesn't trigger unexpected click events. Something that could help is learning more about the use case you're trying to solve with an input inside a clickable element 🙌