-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Select] Create options onPaste event #162
Conversation
✅ Deploy Preview for reablocks-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -0,0 +1,102 @@ | |||
export const keyNameToCode = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this mapping to keep readability for
selectOnKeys={['Space', 'Comma']
I think this more friendly format instead array of numbers (key codes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't really need this with https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is works for Keyboard events (manually filling) but didn't work on paste due to ClipboardEvent (another way to interact with input needs a little bit different handler)
src/form/Select/Select.tsx
Outdated
@@ -639,7 +645,7 @@ export const Select: FC<Partial<SelectProps>> = ({ | |||
|
|||
const onPasteHandler = useCallback( | |||
(e: React.ClipboardEvent<HTMLInputElement>) => { | |||
if (createable && multiple) { | |||
if (createOnPaste && multiple) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it select if its already a 'created' option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if creatable = false but I paste in a option this condition is invalid. I think it should be selectOnPaste
then when combined w/ creatable
would create them or of not just select them.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Screen.Recording.2024-04-30.at.11.38.46.mov
Does this PR introduce a breaking change?
Other information