UI: кнопка «Меню» надёжно открывается на мобильных (onClick вместо pointerup + touch-action)
Открытие бокового меню переведено на нативный onClick: на тач-устройствах pointerup часто не приходит из-за pointercancel, из-за чего меню не открывалось. Долгое удержание (10с → админка) оставлено на таймере и подавляет этот клик. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -31,9 +31,14 @@ export function BottomBar({ onMenu }: { onMenu: () => void }) {
|
|||||||
holdTimer.current = null;
|
holdTimer.current = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const endHold = () => {
|
// Открытие меню — на нативном onClick (надёжно на мобильных, в отличие от pointerup,
|
||||||
clearHold();
|
// который не приходит при pointercancel). Долгий зажим подавляет этот клик.
|
||||||
if (!holdFired.current) onMenu(); // обычный тап
|
const onMenuClick = () => {
|
||||||
|
if (holdFired.current) {
|
||||||
|
holdFired.current = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCreate = () => {
|
const onCreate = () => {
|
||||||
@@ -57,8 +62,9 @@ export function BottomBar({ onMenu }: { onMenu: () => void }) {
|
|||||||
<button
|
<button
|
||||||
className="slot"
|
className="slot"
|
||||||
aria-label="Меню"
|
aria-label="Меню"
|
||||||
|
onClick={onMenuClick}
|
||||||
onPointerDown={startHold}
|
onPointerDown={startHold}
|
||||||
onPointerUp={endHold}
|
onPointerUp={clearHold}
|
||||||
onPointerLeave={clearHold}
|
onPointerLeave={clearHold}
|
||||||
onPointerCancel={clearHold}
|
onPointerCancel={clearHold}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
touch-action: manipulation; /* без задержки/отмены тапа на мобильных */
|
||||||
}
|
}
|
||||||
.bottom-bar .slot .name { color: var(--text); font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bottom-bar .slot .name { color: var(--text); font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bottom-bar .spacer { width: var(--fab-width); flex: 0 0 var(--fab-width); }
|
.bottom-bar .spacer { width: var(--fab-width); flex: 0 0 var(--fab-width); }
|
||||||
|
|||||||
Reference in New Issue
Block a user