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

Delimiters for soft keyboards #181

Merged
merged 3 commits into from
Nov 1, 2019
Merged

Conversation

i-like-robots
Copy link
Owner

@i-like-robots i-like-robots commented Oct 28, 2019

This adds a delimiter check to the onInput callback therefore avoiding the use of KeyboardEvent and the problems therein. It works by comparing the current input value to the previously stored value and checking the last character against the array of delimiter characters and keys.

Tested in:

Browser OS Supports KeyboardEvent.key? Tested and working?
Safari 13 iPhone, iOS 13.1
Safari 13 iPad, iOS 13.0
Chrome 77 Android 10
Firefox 68 Android 10
Samsung Internet 10.1 Android 9

Using the following implementation:

<ReactTags
  tags={this.state.tags}
  suggestions={this.state.suggestions}
  onDelete={this.onDelete.bind(this)}
  onAddition={this.onAddition.bind(this)}
  allowNew={true}
  delimiters={['Enter', 'Tab', ',', ';']} />

This is intended to help fix or improve the issues #94 and #167.

Please note: support for KeyboardEvent.key was tested using https://dvcs.w3.org/hg/d4e/raw-file/tip/key-event-test.html on each device.

This re-implements the delimiterChars option as an array of literal characters. When the entered
query increases in length the last character is checked against this list. This replaces the use
of keyboard events to find out which key was pressed because key mapping does not always occur
when entry is made by a virtual or soft keyboard.
@i-like-robots i-like-robots force-pushed the delimiters-for-soft-keyboards branch from aeb08cf to c07922a Compare October 29, 2019 08:43
@i-like-robots i-like-robots changed the title Delimiters for soft keyboards (WIP) Delimiters for soft keyboards Oct 29, 2019
@i-like-robots i-like-robots merged commit f9b60ae into 6.0 Nov 1, 2019
@i-like-robots i-like-robots deleted the delimiters-for-soft-keyboards branch November 1, 2019 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant