Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only prevent default for tab if it replaces something #572

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
5 changes: 4 additions & 1 deletion lean4-unicode-input-component/src/index.ts
Original file line number Diff line number Diff line change
@@ -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()
}
})