Add physicalKeyboardHighlightPressUsePointerEvents. Fixes #1506

This commit is contained in:
Francisco Hodge 2022-04-12 21:12:00 -07:00
parent d7427c63d6
commit 7834087992
3 changed files with 11 additions and 1 deletions

View File

@ -107,6 +107,8 @@ class SimpleKeyboard {
* @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight
* @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.
* @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.
* @property {boolean} physicalKeyboardHighlightPressUseClick Whether physicalKeyboardHighlightPress should use clicks to trigger buttons.
* @property {boolean} physicalKeyboardHighlightPressUsePointerEvents Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
* @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.
* @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.
* @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.

View File

@ -145,6 +145,11 @@ export interface KeyboardOptions {
*/
physicalKeyboardHighlightPressUseClick?: boolean;
/**
* Whether physicalKeyboardHighlightPress should use pointer events to trigger buttons.
*/
physicalKeyboardHighlightPressUsePointerEvents?: boolean;
/**
* Define the text color that the physical keyboard highlighted key should have.
*/

View File

@ -53,7 +53,10 @@ class PhysicalKeyboard {
options.physicalKeyboardHighlightTextColor || "black";
if (options.physicalKeyboardHighlightPress) {
if (options.physicalKeyboardHighlightPressUseClick) {
if (options.physicalKeyboardHighlightPressUsePointerEvents) {
buttonDOM.onpointerdown();
buttonDOM.onpointerup();
} else if (options.physicalKeyboardHighlightPressUseClick) {
buttonDOM.click();
} else {
instance.handleButtonClicked(buttonName, event);