-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(keyboard): fix fireInputEventIfNeeded (#583)
When a text input with a single character value is selected, typing text which starts with the same character results in the first character of the typed text not to be typed. This occurs as fireInputEventIfNeeded does not fire an input event due to the new value matching the previous value of the input. The next character is then typed and the selected text is then overwritten. This fix changes the fireInputEventIfNeeded condition from no event being fired when the previous and new values match to an event being fired in this scenario when the element value has a selection.
- Loading branch information
1 parent
74d191c
commit 02037d4
Showing
4 changed files
with
123 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {getSelectionRange} from 'utils' | ||
|
||
export function hasSelection(element: Element): boolean { | ||
const {selectionStart, selectionEnd} = getSelectionRange(element) | ||
return selectionStart !== selectionEnd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters