From 64d249090a910841eb051f11db2cfc5868d5d891 Mon Sep 17 00:00:00 2001 From: azimgd Date: Mon, 8 May 2023 18:36:17 +0500 Subject: [PATCH 1/2] fixes arrow focus priority when multiple arrow listeners are subscribed --- src/components/ArrowKeyFocusManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ArrowKeyFocusManager.js b/src/components/ArrowKeyFocusManager.js index e548067f17aa..72a590547fa0 100644 --- a/src/components/ArrowKeyFocusManager.js +++ b/src/components/ArrowKeyFocusManager.js @@ -52,7 +52,7 @@ class ArrowKeyFocusManager extends Component { } this.props.onFocusedIndexChanged(newFocusedIndex); - }, arrowUpConfig.descriptionKey, arrowUpConfig.modifiers, true, false, 1, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']); + }, arrowUpConfig.descriptionKey, arrowUpConfig.modifiers, true, false, 0, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']); this.unsubscribeArrowDownKey = KeyboardShortcut.subscribe(arrowDownConfig.shortcutKey, () => { if (this.props.maxIndex < 0) { @@ -70,7 +70,7 @@ class ArrowKeyFocusManager extends Component { } this.props.onFocusedIndexChanged(newFocusedIndex); - }, arrowDownConfig.descriptionKey, arrowDownConfig.modifiers, true, false, 1, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']); + }, arrowDownConfig.descriptionKey, arrowDownConfig.modifiers, true, false, 0, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']); } componentWillUnmount() { From a2cb5bb268cf94629ccd1269e160ccc947f1e530 Mon Sep 17 00:00:00 2001 From: azimgd Date: Mon, 8 May 2023 19:13:07 +0500 Subject: [PATCH 2/2] reset keyboard shortcut priorities --- src/components/ButtonWithMenu.js | 1 - src/components/OptionsSelector/BaseOptionsSelector.js | 3 +-- src/pages/iou/steps/MoneyRequestAmountPage.js | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/ButtonWithMenu.js b/src/components/ButtonWithMenu.js index 1f8d9a7c0ec5..eea6b5ffb835 100644 --- a/src/components/ButtonWithMenu.js +++ b/src/components/ButtonWithMenu.js @@ -75,7 +75,6 @@ class ButtonWithMenu extends PureComponent { text={selectedItem.text} onPress={event => this.props.onPress(event, this.props.options[0].value)} pressOnEnter - enterKeyEventListenerPriority={1} /> )} {this.props.options.length > 1 && ( diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 3d0362062f2d..01d1612b65d6 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -70,7 +70,6 @@ class BaseOptionsSelector extends Component { enterConfig.modifiers, true, () => !this.state.allOptions[this.state.focusedIndex], - 1, ); const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER; @@ -360,7 +359,7 @@ class BaseOptionsSelector extends Component { text={defaultConfirmButtonText} onPress={this.props.onConfirmSelection} pressOnEnter - enterKeyEventListenerPriority={2} + enterKeyEventListenerPriority={1} /> )} {this.props.footerContent} diff --git a/src/pages/iou/steps/MoneyRequestAmountPage.js b/src/pages/iou/steps/MoneyRequestAmountPage.js index 4cc0b1b2eef2..783f5d59a803 100755 --- a/src/pages/iou/steps/MoneyRequestAmountPage.js +++ b/src/pages/iou/steps/MoneyRequestAmountPage.js @@ -354,7 +354,6 @@ class MoneyRequestAmountPage extends React.Component { pressOnEnter isDisabled={!this.state.amount.length || parseFloat(this.state.amount) < 0.01} text={this.props.buttonText} - enterKeyEventListenerPriority={1} />