mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-11 06:31:51 +08:00
fix(input): issues with typing accented characters in certain linux distros
This commit is contained in:
parent
b783865e5f
commit
01d09cef01
1 changed files with 8 additions and 2 deletions
|
|
@ -1473,10 +1473,16 @@ $("#wordsInput").on("select selectstart", (event) => {
|
|||
});
|
||||
|
||||
$("#wordsInput").on("selectionchange", (event) => {
|
||||
event.preventDefault();
|
||||
const target = event.target as HTMLInputElement;
|
||||
const value = target.value;
|
||||
target.setSelectionRange(value.length, value.length);
|
||||
|
||||
const hasSelectedText = target.selectionStart !== target.selectionEnd;
|
||||
const isCursorAtEnd = target.selectionStart === value.length;
|
||||
|
||||
if (hasSelectedText || !isCursorAtEnd) {
|
||||
// force caret at end of input
|
||||
target.setSelectionRange(value.length, value.length);
|
||||
}
|
||||
});
|
||||
|
||||
$("#wordsInput").on("keydown", (event) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue