diff --git a/packages/joint-core/src/dia/Paper.mjs b/packages/joint-core/src/dia/Paper.mjs
index 5ad5458448..0a4263199d 100644
--- a/packages/joint-core/src/dia/Paper.mjs
+++ b/packages/joint-core/src/dia/Paper.mjs
@@ -302,6 +302,19 @@ const backgroundPatterns = {
const CELL_VIEW_PLACEHOLDER_MARKER = Symbol('joint.cellViewPlaceholderMarker');
+// Is `target`, or any of its ancestors up to and including `boundary`, one of `tagNames`?
+// The press target of `` 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 - `