Skip to content

Commit

Permalink
don't focus if a popover is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Dec 22, 2023
1 parent 6d33542 commit ee93ba6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {defaultProps, propTypes} from './composerWithSuggestionsProps';
import { PopoverContext } from '@components/PopoverProvider';

const {RNTextInputReset} = NativeModules;

Expand Down Expand Up @@ -103,6 +104,7 @@ function ComposerWithSuggestions({
// For testing
children,
}) {
const {isOpen: isPopoverOpen} = React.useContext(PopoverContext);
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -399,8 +401,11 @@ function ComposerWithSuggestions({
* @memberof ReportActionCompose
*/
const focus = useCallback((shouldDelay = false) => {
if (isPopoverOpen) {
return;
}
focusComposerWithDelay(textInputRef.current)(shouldDelay);
}, []);
}, [isPopoverOpen]);

const setUpComposeFocusManager = useCallback(() => {
// This callback is used in the contextMenuActions to manage giving focus back to the compose input.
Expand Down

0 comments on commit ee93ba6

Please sign in to comment.