fix(ui): prevent click handler from firing on macOS Ctrl+click (#1188) (#1189)

* fix(ui): allow mouse interaction with LightTooltip interactive content (#1120)

- Remove pointer-events-none from tooltip content so mouse can enter it
- Add tooltipRef to detect hover state on the tooltip itself
- Replace immediate close with scheduleClose (100ms delay) on mouse leave
- Add onPointerDown handler that skips close for clicks inside tooltip
- Extend isTriggerActive() to check tooltip hover alongside trigger hover

Fixes #1120

* fix(ui): prevent click handler from firing on macOS Ctrl+click (#1188)

macOS: Ctrl+click fires both click and contextmenu events.
Elements with both @click and @contextmenu would trigger unwanted
navigation (ObjectBrowser table row, SqlLibraryPanel folder/file,
QueryHistory entry) alongside the context menu.

Fix: add a capture-phase click listener that stops propagation
when ctrlKey is true. This prevents the click from reaching Vue
handlers while the separate contextmenu event is unaffected.
This commit is contained in:
lexmin0412 2026-06-15 13:25:27 +08:00 committed by GitHub
parent d845a318c6
commit 090f073206
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -1082,6 +1082,15 @@ onMounted(async () => {
if (isDesktop) {
document.addEventListener("contextmenu", handleContextMenu);
}
// macOS: Ctrl+click fires both click and contextmenu.
// Intercept click in capture phase to prevent unwanted navigation.
document.addEventListener(
"click",
(e) => {
if (e.ctrlKey) e.stopPropagation();
},
true,
);
if (!isDesktop) {
try {
const res = await fetch("/api/auth/check");