Skip to content

Android keyboard support workaround code #119

@JohnnyFun

Description

@JohnnyFun

Hi!

I noticed chrome android was setting which and keyCode to 229 since it's a soft keyboard. It seems like a relatively new thing they started doing. Anywho, I ended up just writing the following to make backspace and comma work on my android phone:

handleNonStandardKeyboards() {
	const input = this.taggle.getInput()
	input.addEventListener('keyup', e => {
		const key = e.which || e.keyCode
		const normalKeyboard = key !== 229
		if (normalKeyboard) return
		value = input.value

		//back
		const removing = value.length === 0
		if (removing) {
			const values = this.taggle.tag.values
			this.taggle.remove(values[values.length - 1])
			return
		}

		//comma
		const endsWithComma = /,$/.test(value)
		if (endsWithComma) {
			const tag = value.replace(',', '')
			this.taggle.add(tag)
			input.value = ''
			return
		}
	})
}

I haven't done extensive testing, but hope that helps anyone who runs into the same issue or someone who is more ambitious and willing to write a well-tested pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions