Skip to content

H-6529: fix click detection in entity editor - #9240

Open
claude[bot] wants to merge 2 commits into
mainfrom
claude/h-6529-entity-editor-click-detection
Open

H-6529: fix click detection in entity editor#9240
claude[bot] wants to merge 2 commits into
mainfrom
claude/h-6529-entity-editor-click-detection

Conversation

@claude

@claude claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Requested by Ciaran Morinan · Slack thread

🌟 What is the purpose of this PR?

Fixes click detection in the entity editor's cell editors.

Before. Clicking anything in the choose-data-type modal did nothing. Opening a property that accepts more than one data type showed the type list, but clicks on the options were dead — so there was no way to set or change a value's data type. The same underlying fault made other controls inside cell editors unreliable: an option's description tooltip, a value chip's type icon, a boolean checkbox, or the copy button on a read-only value could dismiss the editor mid-edit. And after editing a validated text or number field and closing the editor with Escape or Tab, click-outside stopped working for every cell editor on the page.

After. Clicks in the choose-data-type modal work — options select, and the data type is applied. Tooltips and controls inside cell editors no longer dismiss the editor. Editors closed with Escape or Tab clean up after themselves.

How. The grid closes a cell editor on any mousedown outside the editor's DOM subtree unless an ancestor of the event target carries click-outside-ignore. The data-type menu and several tooltips render in portals attached to document.body, so they fell outside that subtree and were treated as outside clicks — the menu's mousedown unmounted the editor before the option's click handler could run. Adding that class (the convention the sibling popups in this area already follow) fixes it. Separately, the validation enforcer in the single-value editor added the same class to document.body and a document-level click listener with no unmount cleanup; the teardown is now held in a ref and run from an effect cleanup, so it also runs on the Escape/Tab close path.

🔗 Related links

  • H-6529 (internal) — includes a screen recording of the original bug

🔍 What does this change?

  • data-type-selector.tsx — the data type option menu's popper, and the per-option description tooltip, now carry the ignore class, so pressing the mouse on an option no longer unmounts the editor hosting the menu.
  • single-value-editor.tsx — the validation enforcer's teardown (removing the ignore class from document.body and detaching its document click listener) is held in a ref and run from an effect cleanup, so it also happens when the editor unmounts via Escape or Tab rather than only on a later document click.
  • value-chip.tsx, boolean-input.tsx, readonly-grid-popup.tsx — the tooltips reachable from inside a cell editor are made non-interactive and carry the ignore class, matching the existing treatment in row-action.tsx.
  • Two stale ticket references in touched comments updated from H-1834 to FE-244.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

@hashintel/design-system is private and listed in .changeset/config.json's ignore, so no changeset is needed.

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

Validation was limited, and this needs a reviewer to click through it.

  • No runtime or browser verification was possible in this environment, so the fix has not been observed working. The reasoning is from reading the code paths.
  • tsc and eslint cannot pass cleanly on these packages even on main, because of an unbuildable Rust→wasm artifact. Rather than claim a clean run, both were run on main and on this branch and the output compared: no new findings on the branch.
  • oxfmt --check passes.

🐾 Next steps

  • Worth a sweep for other components portalled to document.body that can be reached from inside a grid cell editor and are still missing the ignore class — this PR covers the ones reachable from the reported flows, not an exhaustive audit.

🛡 What tests cover this?

None. This is DOM-portal and event-ordering behaviour inside Glide Grid's editor overlay, which the current suite does not exercise; no new tests are added here.

❓ How to test this?

  1. Check out the branch, and open an entity in the entity editor.
  2. Find a property whose type permits more than one data type, and start editing it.
  3. Click an option in the choose-data-type list, and confirm the option selects and the data type is applied.
  4. Hover an option to raise its description tooltip, and confirm the editor stays open.
  5. In an array property, hover a value chip's type icon; toggle a boolean property's checkbox; and use the copy button on a read-only value — confirm none of these close the editor.
  6. Edit a validated text or number field, close it with Escape (and again with Tab), then confirm clicking outside still closes other cell editors on the page.

📹 Demo

No demo — see the screen recording of the original bug on H-6529 (internal).

claude added 2 commits August 19, 2026 09:21
The DataTypeSelector renders its option menu in a MUI Popper, which
portals to document.body – outside the DOM tree of the Glide Grid cell
editor that hosts it (EditorTypePicker, used by the entity editor's
value cell for properties with more than one permitted data type).

Glide Grid's ClickOutsideContainer registers a capture-phase mousedown
listener on document and finishes editing whenever the target is outside
the editor's subtree and has no ancestor carrying
GRID_CLICK_IGNORE_CLASS ("click-outside-ignore"). Pressing the mouse on
a data type option therefore unmounted the editor – and with it the
menu – before the option's click handler could run, so choosing a data
type appeared to do nothing.

Add GRID_CLICK_IGNORE_CLASS to the Popper, matching what
selector-autocomplete and the other portalled popups used inside grid
cell editors already do.
Follow-on to the previous commit, covering the rest of the
click-detection defects of the same class in the entity editor's grid
cell editors.

Glide Grid's ClickOutsideContainer ends editing on any capture-phase
mousedown whose target is neither inside the editor's subtree nor under an
ancestor carrying GRID_CLICK_IGNORE_CLASS. Anything portalled to
document.body therefore has to opt out explicitly.

Stale global click-outside suppression (single-value-editor):
ensureFormValidation adds GRID_CLICK_IGNORE_CLASS to document.body and
attaches a document click listener, but only removed them inside
validationHandler, which needs a later document click to run. Grid closes
overlays on Escape and Tab without any click, so the editor could unmount
with both still in place – disabling click-outside for every grid editor on
the page (Glide walks parentElement up to body) and leaving a listener that
calls onFinishedEditing from an unmounted editor's closure. The teardown is
now held in a ref and run from a useEffect cleanup, so it happens on unmount
too. Validation behaviour itself is unchanged.

Unguarded MUI tooltips: tooltips are interactive by default, so their
poppers keep pointer-events: auto and portal to document.body, making a
mousedown on one read as a click outside the editor. Add disableInteractive
and the ignore class to the four reachable from inside a grid cell editor,
matching row-action.tsx:
- DataTypeLabel's description tooltip, which wraps every option row in the
  data type menu
- array-editor value-chip, boolean-input, readonly-grid-popup

Also trims the comment added in the previous commit to the surrounding
density, and updates the two stale H-1834 references to FE-244.
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 19, 2026 9:32am
petrinaut-docs Ready Ready Preview Aug 19, 2026 9:32am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Aug 19, 2026 9:32am
petrinaut Skipped Skipped Aug 19, 2026 9:32am

@github-actions github-actions Bot added area/apps > hash* Affects HASH (a `hash-*` app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps labels Aug 19, 2026
@claude
claude Bot marked this pull request as ready for review August 19, 2026 09:49
@claude
claude Bot requested a review from CiaranMn August 19, 2026 09:49
@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit f60c23c. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants