-
-
Notifications
You must be signed in to change notification settings - Fork 239
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: Handle Enter key event for IME inputs #3272
base: main
Are you sure you want to change the base?
fix: Handle Enter key event for IME inputs #3272
Conversation
Quality Gate passedIssues Measures |
For my own reference, this is the documentation of the code added https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for doing this - I would have had no idea this was the solution.
I looked for other uses of the same pattern elsewhere in Tasks, and found these:
obsidian-tasks/src/Suggestor/EditorSuggestorPopup.ts
Lines 107 to 116 in d26fd2e
if (value.suggestionType === 'empty') { | |
// Close the suggestion dialog and simulate an Enter press to the editor | |
this.close(); | |
const eventClone = new KeyboardEvent('keydown', { | |
code: 'Enter', | |
key: 'Enter', | |
}); | |
(editor as any)?.cm?.contentDOM?.dispatchEvent(eventClone); | |
return; | |
} |
obsidian-tasks/src/ui/Dependency.svelte
Lines 57 to 66 in 4e8c961
case 'Enter': | |
if (searchIndex !== null) { | |
e.preventDefault(); | |
addTask(searchResults[searchIndex]); | |
searchIndex = null; | |
inputFocused = false; | |
} else { | |
_onDescriptionKeyDown(e); | |
} | |
break; |
Are they things you would be interested in looking at too?
(I've edited the comment about to increase the number of lines of code shown, for readability) |
Types of changes
fix
- non-breaking change which fixes an issue)Description
“Create or edit Task" Modal input, there was a conflict between the Enter key event used to confirm IME conversions and the Enter key event used to create tasks, causing unintended behavior.
This has been corrected so that the Enter key is not used to create a task when the IME conversion is confirmed.
Motivation and Context
How has this been tested?
Manually tested the following
Screenshots (if appropriate)
before fix
IME_input.mov
after fix
IME_input_after_fix.mov
Checklist
yarn run lint
.Terms