From 69b9003decf5e5e51d54b866caf5aaa13dd82d51 Mon Sep 17 00:00:00 2001 From: Roman Bruckner Date: Tue, 11 Aug 2026 18:52:22 +0200 Subject: [PATCH 1/2] fix: let the guard option veto a blank pointerdown; buttons that click and drag Backport of #3438 (targets dev) onto master. Net change of the PR's 10 commits, applied to master's identical core/preset base. - joint-core: split guard() into guardExplicit() (event-level veto/allow) + guard() (event + target), so options.guard can veto a blank pointerdown; split FORM_CONTROL_TAG_NAMES vs PREVENT_INTERACTION_TAG_NAMES and match both across the target path (not just evt.target); drop OPTION. - joint-react: preset guards portaled overlay content via guardExplicit, lets a ` is the SPAN, so testing the +// target alone would tell us nothing about the control it belongs to. +function hasTagNameInPath(target, tagNames, boundary) { + let node = target; + while (node) { + if (tagNames.includes(node.tagName)) return true; + if (node === boundary) return false; + node = node.parentElement; + } + return false; +} + export const Paper = View.extend({ className: 'paper', @@ -587,9 +600,19 @@ export const Paper = View.extend({ _layers: null, UPDATE_DELAYING_BATCHES: ['translate'], - // If you interact with these elements, - // the default interaction such as `element move` is prevented. - FORM_CONTROL_TAG_NAMES: ['TEXTAREA', 'INPUT', 'BUTTON', 'SELECT', 'OPTION'] , + // If you interact with these elements, the browser's own default action is kept + // (the paper does not call `preventDefault()`), so a text input can be focused and + // its text selected, a checkbox can be ticked, a button can be pressed. Matched + // against the whole path up to the cell view, so a press on markup inside a control + // counts as a press on the control - `