Skip to content

Commit

Permalink
Add key listener workaround for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Jul 8, 2024
1 parent 4b804a7 commit c275a7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scripts/h5p-crossword-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export default class CrosswordInput {
}

const start = inputField.selectionStart;
console.log(event.key, inputField.value, start);

Check failure on line 207 in src/scripts/h5p-crossword-input.js

View workflow job for this annotation

GitHub Actions / build / build

Unexpected console statement

inputField.value = `${inputField.value.substr(0, start + 1)}${inputField.value.substr(start + 1)}`;
inputField.selectionEnd = start + 1;

Expand Down Expand Up @@ -231,7 +233,7 @@ export default class CrosswordInput {
text: after,
readOffset: -1 // don't read
});
}, 0); // selectionStart will be 0 before DOM rendered
}, 25); // selectionStart will be 0 before DOM rendered
}, false);

// Only update table if input is valid or using arrow keys
Expand Down

0 comments on commit c275a7f

Please sign in to comment.