Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.78k stars 723 forks source link

Backspace error with input using text-align: right; #628

Closed obermillerk closed 6 years ago

obermillerk commented 6 years ago

Expected Behavior

Say I have an input element, text-align is set to right, and I have the text my input element input into it. I position my caret to the left of the word input (my |input element) and start pressing backspace. The text my should be deleted, and all subsequent backspace actions after these three characters should do nothing, leaving the caret positioned at the left of the input and resulting in the text input element.

Actual behavior

What actually happens is that once my has been deleted, when the text equals input element and the caret is located at the far left (in other words, after three backspace presses), the next time backspace is pressed the caret jumps to the far right of the input and subsequent backspaces continue to delete the rest of the text. This behavior happens whether using the virtual keyboard or a physical keyboard, just so long as the virtual keyboard is activated on the input.

I have created a fiddle forked from your playground fiddle that demonstrates this. You can use the first text box to see the behavior with the virtual keyboard (using either physical or virtual keyboard), and the second (non-styled, no virtual keyboard) text box to see the expected behavior.

Mottie commented 6 years ago

Hi @obermillerk!

Thanks for reporting this issue! I'll get it fixed shortly.

obermillerk commented 6 years ago

Wow, that was fast...

Thanks, I can confirm that it's fixed! Cool library, by the way. 👍