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

Fixes #94 - Changes to support Android Chrome #97

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ajmas
Copy link
Contributor

@ajmas ajmas commented Sep 26, 2017

Changes to ensure we support Google Chrome on Android, due to limitations around the soft keyboards and KeyboardEvent.key in onKeydown().

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.

@coveralls
Copy link

coveralls commented Sep 26, 2017

Coverage Status

Coverage decreased (-4.9%) to 94.527% when pulling 7498d30 on ajmas:issue-94-android-chrome into d2770e7 on i-like-robots:master.

@coveralls
Copy link

coveralls commented Sep 26, 2017

Coverage Status

Coverage decreased (-4.9%) to 94.527% when pulling 5987cab on ajmas:issue-94-android-chrome into d2770e7 on i-like-robots:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 100.0% when pulling 6f7e841 on ajmas:issue-94-android-chrome into d2770e7 on i-like-robots:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 100.0% when pulling 6f7e841 on ajmas:issue-94-android-chrome into d2770e7 on i-like-robots:master.

@ajmas
Copy link
Contributor Author

ajmas commented Sep 26, 2017

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: `[',']`
Copy link
Owner

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.
Copy link
Owner

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?

Copy link
Contributor Author

@ajmas ajmas Sep 27, 2017

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.
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the description!

@i-like-robots
Copy link
Owner

@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).

@i-like-robots
Copy link
Owner

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.

@coveralls
Copy link

coveralls commented Sep 27, 2017

Coverage Status

Coverage increased (+0.6%) to 100.0% when pulling 76696cf on ajmas:issue-94-android-chrome into d2770e7 on i-like-robots:master.

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

Successfully merging this pull request may close these issues.

3 participants