From 3cc64b576429b050ea356c3c76b8bf72f4a5b9b7 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 28 Nov 2025 23:43:16 +0200 Subject: [PATCH] fix(mobile/context_menu): note color picker not working --- .../menus/custom-items/NoteColorPicker.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/client/src/menus/custom-items/NoteColorPicker.tsx b/apps/client/src/menus/custom-items/NoteColorPicker.tsx index 08bc7c84a..847ae484e 100644 --- a/apps/client/src/menus/custom-items/NoteColorPicker.tsx +++ b/apps/client/src/menus/custom-items/NoteColorPicker.tsx @@ -8,6 +8,7 @@ import Color, { ColorInstance } from "color"; import Debouncer from "../../utils/debouncer"; import FNote from "../../entities/fnote"; import froca from "../../services/froca"; +import { isMobile } from "../../services/utils"; const COLOR_PALETTE = [ "#e64d4d", "#e6994d", "#e5e64d", "#99e64d", "#4de64d", "#4de699", @@ -62,13 +63,13 @@ export default function NoteColorPicker(props: NoteColorPickerProps) { } else { attributes.removeOwnedLabelByName(note, "color"); } - + setCurrentColor(color); } }, [note, currentColor]); return
- + - - + + {COLOR_PALETTE.map((color) => ( (null); const colorInputDebouncer = useRef | null>(null); const callbackRef = useRef(props.onSelect); - const isSafari = useRef(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)); useEffect(() => { colorInputDebouncer.current = new Debouncer(250, (color) => { @@ -160,13 +160,13 @@ function CustomColorCell(props: ColorCellProps) { }, [pickedColor]); return
{ - // The color picker dropdown will close on Safari if the parent context menu is + onClick={isMobile() ? (e) => { + // The color picker dropdown will close on some browser if the parent context menu is // dismissed, so stop the click propagation to prevent dismissing the menu. - isSafari.current && e.stopPropagation(); - }}> + e.stopPropagation(); + } : undefined}>