Skip to content

Commit 01d09ce

Browse files
committed
fix(input): issues with typing accented characters in certain linux distros
1 parent b783865 commit 01d09ce

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/src/ts/controllers/input-controller.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,10 +1473,16 @@ $("#wordsInput").on("select selectstart", (event) => {
14731473
});
14741474

14751475
$("#wordsInput").on("selectionchange", (event) => {
1476-
event.preventDefault();
14771476
const target = event.target as HTMLInputElement;
14781477
const value = target.value;
1479-
target.setSelectionRange(value.length, value.length);
1478+
1479+
const hasSelectedText = target.selectionStart !== target.selectionEnd;
1480+
const isCursorAtEnd = target.selectionStart === value.length;
1481+
1482+
if (hasSelectedText || !isCursorAtEnd) {
1483+
// force caret at end of input
1484+
target.setSelectionRange(value.length, value.length);
1485+
}
14801486
});
14811487

14821488
$("#wordsInput").on("keydown", (event) => {

0 commit comments

Comments
 (0)