diff --git a/app/components/ContextMenu/MenuItem.js b/app/components/ContextMenu/MenuItem.js index e841949d..a82d9222 100644 --- a/app/components/ContextMenu/MenuItem.js +++ b/app/components/ContextMenu/MenuItem.js @@ -26,20 +26,29 @@ const MenuItem = ({ hide, ...rest }: Props) => { - // We bind to mousedown instead of onClick here as otherwise menu items do not - // work in Firefox which triggers the hideOnClickOutside handler first via - // mousedown. - const handleMouseDown = React.useCallback( + const handleClick = React.useCallback( (ev) => { if (onClick) { ev.preventDefault(); ev.stopPropagation(); onClick(ev); } + + if (hide) { + hide(); + } }, - [onClick] + [onClick, hide] ); + // Preventing default mousedown otherwise menu items do not work in Firefox, + // which triggers the hideOnClickOutside handler first via mousedown – hiding + // and un-rendering the menu contents. + const handleMouseDown = React.useCallback((ev) => { + ev.preventDefault(); + ev.stopPropagation(); + }, []); + return ( {selected !== undefined && ( <> diff --git a/app/scenes/Document/components/Editor.js b/app/scenes/Document/components/Editor.js index 48a44ded..213a8633 100644 --- a/app/scenes/Document/components/Editor.js +++ b/app/scenes/Document/components/Editor.js @@ -33,7 +33,7 @@ type Props = {| @observer class DocumentEditor extends React.Component { @observable activeLinkEvent: ?MouseEvent; - @observable ref = React.createRef(); + ref = React.createRef(); focusAtStart = () => { if (this.props.innerRef.current) { @@ -110,8 +110,6 @@ class DocumentEditor extends React.Component { const normalizedTitle = !title && readOnly ? document.titleWithDefault : title; - console.log(this.ref.current); - return ( {readOnly ? (