Editor: Fix bug adding tags on Hebrew keyboards #2511
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #740. The Hebrew letter "ת" is in the position of the comma key on US keyboards. As a result, pressing this letter in the editor tags control will add the currently typed tag instead of adding the letter.
Handling special keys like arrows and Enter in
onKeyDown
based on theirkeyCode
works well, but for comma and other keys that result in typed characters, we should useonKeyPress
andcharCode
to correctly determine the character that was typed.This PR also fixes a bonus related bug: currently it is possible to add tags consisting of only whitespace by pressing the comma key.
To test
Switch your keyboard layout to Hebrew. For those unfamiliar with this process, like I was, here's a poor-quality GIF demonstrating how to do it on OS X:
Navigate to the post editor and activate the tags control. Type a few letters and then press the comma key to send "ת". Verify that the letter is typed instead of adding the currently typed tag.
Also, type a tag consisting of only one or more spaces, then press the comma key and verify that this does nothing instead of adding an empty tag.