Skip to content

Commit

Permalink
fix: only prevent default for tab if it replaces something
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobvase committed Jan 19, 2025
1 parent 3f499d0 commit a2bdad3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lean4-unicode-input-component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leanprover/unicode-input-component",
"version": "0.1.0",
"version": "0.1.1",
"description": "Typescript support for contenteditable divs with the Unicode input support of the Lean 4 theorem prover",
"scripts": {
"watch": "tsc --watch",
Expand Down
5 changes: 4 additions & 1 deletion lean4-unicode-input-component/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,12 @@ export class InputAbbreviationRewriter implements AbbreviationTextSource {
})

textInput.addEventListener('keydown', async (ev: KeyboardEvent) => {
if (ev.key === 'Tab') {
if (ev.key === 'Tab' && this.rewriter.getTrackedAbbreviations().size > 0) {
await this.rewriter.replaceAllTrackedAbbreviations()
this.updateState()
// Don't send event to any other listeners, it was handled here.
ev.stopImmediatePropagation()
// Don't move focus to the next element.
ev.preventDefault()
}
})
Expand Down

0 comments on commit a2bdad3

Please sign in to comment.