-
Notifications
You must be signed in to change notification settings - Fork 170
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
Fixes #94 - Changes to support Android Chrome #97
base: main
Are you sure you want to change the base?
Conversation
1 similar comment
Note, there were two three cases where there was no reasonable way of creating proper code coverage, so I opted to exclude them. Let me know if you have any issues with that. |
|
||
#### delimiterChars (optional) | ||
|
||
Array of characters matching keyboard event `key` values. This is useful when needing to support a specific character irrespective of the keyboard layout. Note, that this list is separate from the one specified by the `delimiters` option, so you'll need to set the value there to `[]`, if you wish to disable those keys. Example usage: `delimiterChars={[',', ' ']}`. Default: `[]` | ||
Array of characters matching characters that can be displayed in an input field. This is useful when needing to support a specific character irrespective of the keyboard layout, such as for internationalisation. Example usage: `delimiterChars={[',', ' ']}`. Default: `[',']` |
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.
Nice distinction 👍
@@ -156,7 +156,7 @@ Override the default class names. Defaults: | |||
|
|||
#### handleAddition (required) | |||
|
|||
Function called when the user wants to add a tag. Receives the tag. | |||
Function called when the user wants to add one or more tags. Receives the tag or tags. Value can be a tag or an Array of tags. |
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 think this could be considered a breaking change, it might better to invoke the callback once for each tag to avoid that?
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.
It is, but I couldn't seem to get things to behave otherwise, when I was testing with the example. I can make another branch in my fork to show you the issue?
The issue happens when a paste is made. If I do a single call then then tags stay as should, but if I do multiple calls we lose the intermediate tags. For example, try pasting
Thailand, India, Indonesia,
This is not an issue in normal times.
Here is the other branch to check behaviour with: https://github.com/ajmas/react-tags/tree/no-addtag-array
* `KeyboardEvent.key` having an undefined value, when using soft keyboards. | ||
* in Android's version of Google Chrome. This method also handles the paste | ||
* scenario, without needing to provide a supplemental 'onPaste' handl+er. | ||
*/ |
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.
Thanks for the description!
@ajmas wow, good work! This (to me) is quite a bit nicer than the onPaste implementation, and great work covering the edge cases too. I will give this a good test today and let's get it sorted this week as it's dragged on for too long (my fault entirely). |
Re. the test coverage @ajmas - I really don't mind, so long as the main features and interface is covered then I'm not bothered about implementation detail being missed. |
07a315c
to
dbd521f
Compare
Changes to ensure we support Google Chrome on Android, due to limitations around the soft keyboards and
KeyboardEvent.key
inonKeydown()
.Also changes here provide support for the pasting too, without needing to use
onPaste
event.Note, code coverage is reduced in this pull, but it is more to get feedback at this point. Will add them back in due course.