Fix timeline scrolling automatically while emoji picker is open

This commit is contained in:
Jamie Kyle 2023-09-19 12:01:04 -07:00 committed by GitHub
parent 01231eb1c6
commit f115ba5873
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 150 additions and 11 deletions

View file

@ -33,6 +33,7 @@ import {
} from '../../hooks/useKeyboardShortcuts';
import { PanelType } from '../../types/Panels';
import type { DeleteMessagesPropsType } from '../../state/ducks/globalModals';
import { useScrollerLock } from '../../hooks/useScrollLock';
export type PropsData = {
canDownload: boolean;
@ -175,6 +176,14 @@ export function TimelineMessage(props: Props): JSX.Element {
[reactionPickerRoot]
);
useScrollerLock({
reason: 'TimelineMessage reactionPicker',
lockScrollWhen: reactionPickerRoot != null,
onUserInterrupt() {
toggleReactionPicker(true);
},
});
useEffect(() => {
let cleanUpHandler: (() => void) | undefined;
if (reactionPickerRoot) {