SyntaxUI / syntaxui

Get free access to pre-built, Tailwind CSS-powered components, animations and effects - brought to life using Framer Motion. Just copy, paste and you're ready to go!
https://syntaxui.com
MIT License
636 stars 45 forks source link

[BUG]: input submit on delete #115

Closed epoll31 closed 2 months ago

epoll31 commented 2 months ago

Description 📝

Input component has bug where deleting old badges will perform an onSubmit action.

Link 🔗

https://syntaxui.com/docs/components/input

Steps to Reproduce 🔄

  1. Go to https://syntaxui.com/docs/components/input
  2. Type something into the input
  3. Press on an x on a badge to remove it

Screenshots 📸

https://github.com/Ansub/SyntaxUI/assets/16091805/06001824-7870-4be7-822d-896d7489de0a

Expected Behavior 🤔

Removing an old badge will not submit the new one

Actual Behavior 😱

Removing an old badge will submit the new one

Environment 🌍

n/a

Additional Information ℹī¸

No response

adii1203 commented 2 months ago

I think this behavior is intentional because of onBlur handler. if input has value and it loses focus the onBlur handler will add the value in keywords state.

if you think this is an actual bug I would like to contribute @Ansub :)

Ansub commented 2 months ago

yeah you are right @adii1203 but i think it will be a better UX if we do it like @epoll31 is saying

if you want to contribute to this, it's all yours. lmk so that i can assign this issue to you :)

adii1203 commented 2 months ago

I have created the PR, let me know what you think about my solution. @Ansub @epoll31

Ansub commented 2 months ago

s