Skip to content

Commit

Permalink
Fix text formatting error with non-Roman inputs (#2204)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 3, 2019
1 parent cb19423 commit 6d852ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/features/comment-fields-keyboard-shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function init(): void {
select<HTMLTextAreaElement>('.js-comment-field', lastOwnComment)!.selectionStart = Number.MAX_SAFE_INTEGER;
});
}
} else if (formattingCharacters.includes(event.key)) {
} else if (formattingCharacters.includes(event.key) && !event.isComposing) {
const [start, end] = [field.selectionStart, field.selectionEnd];

// If `start` and `end` of selection are the same, then no text is selected
Expand Down
5 changes: 5 additions & 0 deletions source/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,8 @@ declare namespace JSX {
interface NamedNodeMap {
[key: string]: Attr;
}

// TODO: Drop when this appears on npm https://github.com/microsoft/TypeScript/blob/340f81035ff1d753e6a1f0fedc2323d169c86cc6/src/lib/dom.generated.d.ts#L9686
interface KeyboardEvent {
readonly isComposing: boolean;
}

0 comments on commit 6d852ce

Please sign in to comment.