Skip to content

Commit

Permalink
return early if the active element is another emoji picker btn
Browse files Browse the repository at this point in the history
  • Loading branch information
s77rt committed Sep 30, 2024
1 parent 6e89076 commit 78c3c4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import DomUtils from '@libs/DomUtils';
import {getDraftComment} from '@libs/DraftCommentUtils';
import getModalState from '@libs/getModalState';
import Performance from '@libs/Performance';
Expand Down Expand Up @@ -515,6 +516,10 @@ function ReportActionCompose({
if (isNavigating) {
return;
}
const activeElementId = DomUtils.getActiveElement()?.id;
if (activeElementId === CONST.COMPOSER.NATIVE_ID || activeElementId === CONST.EMOJI_PICKER_BUTTON_NATIVE_ID) {
return;
}
focus();
}}
onEmojiSelected={(...args) => composerRef.current?.replaceSelectionWithText(...args)}
Expand Down
5 changes: 5 additions & 0 deletions src/pages/home/report/ReportActionItemMessageEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ComposerUtils from '@libs/ComposerUtils';
import DomUtils from '@libs/DomUtils';
import * as EmojiUtils from '@libs/EmojiUtils';
import focusComposerWithDelay from '@libs/focusComposerWithDelay';
import type {Selection} from '@libs/focusComposerWithDelay/types';
Expand Down Expand Up @@ -561,6 +562,10 @@ function ReportActionItemMessageEdit(
<EmojiPickerButton
isDisabled={shouldDisableEmojiPicker}
onModalHide={() => {
const activeElementId = DomUtils.getActiveElement()?.id;
if (activeElementId === CONST.COMPOSER.NATIVE_ID || activeElementId === CONST.EMOJI_PICKER_BUTTON_NATIVE_ID) {
return;
}
ReportActionComposeFocusManager.focus();
}}
onEmojiSelected={addEmojiToTextBox}
Expand Down

0 comments on commit 78c3c4a

Please sign in to comment.