From 4bb461971eda81978d0ac3dff735618e1a09b6b8 Mon Sep 17 00:00:00 2001 From: astrohunter62 Date: Wed, 4 Oct 2023 08:50:44 -0700 Subject: [PATCH 1/5] 28324 --- src/components/LHNOptionsList/OptionRowLHN.js | 6 +++++- src/components/PopoverProvider/index.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 3cfd7c4c4138..356f22b9d396 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -25,6 +25,7 @@ import * as ReportUtils from '../../libs/ReportUtils'; import useLocalize from '../../hooks/useLocalize'; import Permissions from '../../libs/Permissions'; import Tooltip from '../Tooltip'; +import DomUtils from '../../libs/DomUtils'; const propTypes = { /** Style for hovered state */ @@ -162,7 +163,10 @@ function OptionRowLHN(props) { // Prevent losing Composer focus e.preventDefault(); }} - onSecondaryInteraction={(e) => showPopover(e)} + onSecondaryInteraction={(e) => { + showPopover(e); + DomUtils.blurActiveElement(); + }} withoutFocusOnSecondaryInteraction activeOpacity={0.8} style={[ diff --git a/src/components/PopoverProvider/index.js b/src/components/PopoverProvider/index.js index efa230d920d5..3501ff7055f3 100644 --- a/src/components/PopoverProvider/index.js +++ b/src/components/PopoverProvider/index.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import ReportActionComposeFocusManager from '../../libs/ReportActionComposeFocusManager'; const propTypes = { children: PropTypes.node.isRequired, @@ -24,6 +25,7 @@ function PopoverContextProvider(props) { } activePopoverRef.current.close(); activePopoverRef.current = null; + ReportActionComposeFocusManager.focus(); setIsOpen(false); }, []); From 82b7f02b6c47f6fbf6de0dc2fc90467dc5b2a3f4 Mon Sep 17 00:00:00 2001 From: astrohunter62 Date: Mon, 9 Oct 2023 23:06:26 -0700 Subject: [PATCH 2/5] removed ReportActionComposeFocusManager from PopoverProvider --- src/components/LHNOptionsList/OptionRowLHN.js | 3 ++- src/components/PopoverProvider/index.js | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index f1fd6ac7c9ed..a9da58619abe 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -28,6 +28,7 @@ import Permissions from '../../libs/Permissions'; import Tooltip from '../Tooltip'; import DomUtils from '../../libs/DomUtils'; import useWindowDimensions from '../../hooks/useWindowDimensions'; +import ReportActionComposeFocusManager from '../../libs/ReportActionComposeFocusManager'; const propTypes = { /** Style for hovered state */ @@ -173,7 +174,7 @@ function OptionRowLHN(props) { if (e) { e.preventDefault(); } - + ReportActionComposeFocusManager.focus(); props.onSelectRow(optionItem, popoverAnchor); }} onMouseDown={(e) => { diff --git a/src/components/PopoverProvider/index.js b/src/components/PopoverProvider/index.js index 3501ff7055f3..efa230d920d5 100644 --- a/src/components/PopoverProvider/index.js +++ b/src/components/PopoverProvider/index.js @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import ReportActionComposeFocusManager from '../../libs/ReportActionComposeFocusManager'; const propTypes = { children: PropTypes.node.isRequired, @@ -25,7 +24,6 @@ function PopoverContextProvider(props) { } activePopoverRef.current.close(); activePopoverRef.current = null; - ReportActionComposeFocusManager.focus(); setIsOpen(false); }, []); From 2ca6049463f4e33e9040902e6202cf902072b8a8 Mon Sep 17 00:00:00 2001 From: astrohunter62 Date: Fri, 13 Oct 2023 08:45:16 -0700 Subject: [PATCH 3/5] add comment --- src/components/LHNOptionsList/OptionRowLHN.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 00001b1572fa..a0d3c59bdd5c 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -169,6 +169,7 @@ function OptionRowLHN(props) { if (e) { e.preventDefault(); } + // Enable Composer to focus on clicking the same chat after opening the context menu. ReportActionComposeFocusManager.focus(); props.onSelectRow(optionItem, popoverAnchor); }} @@ -184,9 +185,9 @@ function OptionRowLHN(props) { testID={optionItem.reportID} onSecondaryInteraction={(e) => { showPopover(e); - DomUtils.blurActiveElement(); + // Composer blur when opening context menu + DomUtils.getActiveElement().blur(); }} - withoutFocusOnSecondaryInteraction activeOpacity={0.8} style={[ From 3aa0000c695e69ef7200f4c94d174729ad66eab7 Mon Sep 17 00:00:00 2001 From: astrohunter62 <136574831+astrohunter62@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:53:22 -0400 Subject: [PATCH 4/5] Update src/components/LHNOptionsList/OptionRowLHN.js Co-authored-by: Joel Davies --- src/components/LHNOptionsList/OptionRowLHN.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index a0d3c59bdd5c..d85cd63a0b0b 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -185,7 +185,7 @@ function OptionRowLHN(props) { testID={optionItem.reportID} onSecondaryInteraction={(e) => { showPopover(e); - // Composer blur when opening context menu + // Ensure that we blur the composer when opening context menu, so that only one component is focused at a time DomUtils.getActiveElement().blur(); }} withoutFocusOnSecondaryInteraction From d83fb5c48ac0037353dbe74e79bd523485d5b008 Mon Sep 17 00:00:00 2001 From: astrohunter62 Date: Fri, 13 Oct 2023 08:59:56 -0700 Subject: [PATCH 5/5] revert --- src/components/LHNOptionsList/OptionRowLHN.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index a0d3c59bdd5c..897019f77a1c 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -175,7 +175,7 @@ function OptionRowLHN(props) { }} onMouseDown={(e) => { // Allow composer blur on right click - if (!e || e.button === 2) { + if (!e) { return; } @@ -185,7 +185,7 @@ function OptionRowLHN(props) { testID={optionItem.reportID} onSecondaryInteraction={(e) => { showPopover(e); - // Composer blur when opening context menu + // // Ensure that we blur the composer when opening context menu, so that only one component is focused at a time DomUtils.getActiveElement().blur(); }} withoutFocusOnSecondaryInteraction