Skip to content

Commit

Permalink
fixes #6543
Browse files Browse the repository at this point in the history
  • Loading branch information
night committed Jan 1, 2024
1 parent 3a17549 commit 1081efa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/modules/emote_menu/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import styles from './Button.module.css';
import EmoteMenuPopover from './EmoteMenuPopover.jsx';
import {markTipAsSeen} from './Tip.jsx';

export default function Button({isLegacy = false, appendToChat, className, boundingQuerySelector}) {
export default function Button({
isLegacy = false,
appendToChat,
className,
boundingQuerySelector,
containerQuerySelector,
}) {
const [loaded, setLoaded] = useState(false);
const [whisperOpen, setWhisperOpen] = useState(false);
const whisperRef = useRef(null);
Expand Down Expand Up @@ -59,6 +65,9 @@ export default function Button({isLegacy = false, appendToChat, className, bound
ref={whisperRef}
onOpen={() => setWhisperOpen(true)}
onClose={() => setWhisperOpen(false)}
container={
containerQuerySelector != null ? () => document.querySelector(containerQuerySelector) ?? undefined : undefined
}
trigger="click"
placement={null} // this throws a warning but is necessary to stop rsuite from auto-respositioning
speaker={
Expand Down
2 changes: 2 additions & 0 deletions src/modules/emote_menu/twitch/EmoteMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import watcher from '../../../watcher.js';
import EmoteMenuButton from '../components/Button.jsx';
import styles from './EmoteMenu.module.css';

const CONTAINER_QUERY_SELECTOR = '#root';
const CHAT_TEXT_AREA = 'textarea[data-a-target="chat-input"], div[data-a-target="chat-input"]';

// For legacy button
Expand Down Expand Up @@ -142,6 +143,7 @@ function loadButton() {
onError={() => unloadButton(buttonContainer, nativeEmotePickerButton)}
appendToChat={appendToChat}
className={styles.button}
containerQuerySelector={CONTAINER_QUERY_SELECTOR}
boundingQuerySelector={CHAT_TEXT_AREA}
/>
);
Expand Down

0 comments on commit 1081efa

Please sign in to comment.