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

Support pasting codes as "XXX-XXX" #53

Open
necky2 opened this issue Jun 14, 2024 · 5 comments
Open

Support pasting codes as "XXX-XXX" #53

necky2 opened this issue Jun 14, 2024 · 5 comments

Comments

@necky2
Copy link

necky2 commented Jun 14, 2024

Is your feature request related to a problem? Please describe.
By my understanding, splitting a code into 2 parts is done for better user readability. This library supports and even suggests, configuring the input as "XXX-XXX". I think it's a problem that a code with a hyphen or space in the middle cannot be pasted into the field.

Describe the solution you'd like
Accept pasting of "XXX-XXX" and "XXX XXX" (and possibly other formats)

Describe alternatives you've considered
-

Additional context
I can have a shot at implementing this if others agree that this makes sense.

@guilhermerodz
Copy link
Owner

@necky2 thanks for bringing that up. While I still can't think of a great solution for this, there's a workaround such as handling onPaste event.

That would require a change on the current implementation, because it's always calling the library's default pasteListener.

If I allow for the user/developer setting up a custom paste event listener over the default library behavior, then it should be possible. I'm also not sure whether or not input.selectionStart and input.selectionEnd should be managed during this act of pasting a code with a decorative character.

@trm217
Copy link

trm217 commented Aug 6, 2024

@guilhermerodz Pasting should really be a thing. From how I know the usage behaviour, the majority of people still use plain old copy and paste.

@buffalom
Copy link

Any update on this? Even just allowing me to reformat the pasted value before the built-in pasteListener is called should be sufficient for my use case.

@necky2
Copy link
Author

necky2 commented Sep 25, 2024

Any update on this? Even just allowing me to reformat the pasted value before the built-in pasteListener is called should be sufficient for my use case.

I removed the hyphen from the emails that I send to customers, problem "solved". If you get this issue moving and support is added for this, I would still appreciate that.

@buffalom
Copy link

I removed the hyphen from the emails that I send to customers, problem "solved". If you get this issue moving and support is added for this, I would still appreciate that.

In our case, it's not a hyphen in between the code groups, but rather a prefix at the start of the code. Something like A-12345. Just to add to the list of use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants