Skip to content

fix: make spreadsheet overlays native popover, per instance#9303

Open
DiegoCardoso wants to merge 3 commits into
mainfrom
refactor/spreadsheet/native-popover
Open

fix: make spreadsheet overlays native popover, per instance#9303
DiegoCardoso wants to merge 3 commits into
mainfrom
refactor/spreadsheet/native-popover

Conversation

@DiegoCardoso
Copy link
Copy Markdown
Contributor

The spreadsheet attaches a <div id="spreadsheet-overlays"> to host its overlay widgets (context menu, tooltips, comment overlays, popup buttons). It has historically lived in <body> to escape clipping by ancestor overflow/transform rules and as a singleton shared by all spreadsheet instances on the page. Switching the overlays to native popover changes the picture: every overlay enters the top layer regardless of DOM position, so neither the body-attachment nor the singleton are load-bearing anymore.

This PR includes the native popover changes proposed in #9270 and adds the structural changes that the popover approach enables:

  • the container moves into the <vaadin-spreadsheet> light DOM, projected into the shadow root via a new overlays slot, with one container per instance;
  • the reference is threaded from JS into the GWT widget chain instead of being looked up by id;
  • SpreadsheetConnector — not ApplicationConnection — now owns the SpreadsheetContextMenu.

Tooltips and the cell-comment overlay are created in SheetWidget's constructor (before the host is known), so the container is wired in via a setter rather than a constructor argument.

A side benefit: spreadsheet overlays inside a modal Dialog are interactive again. The modal sets body { pointer-events: none } to disable everything outside the dialog overlay; with the container now inside the dialog's slotted content, the overlays inherit pointer-events: auto from the dialog's overlay part instead of pointer-events: none from <body>.

Intended to replace #9270.

Related to #9270


🤖 Generated with Claude Code

TatuLund and others added 3 commits May 12, 2026 11:43
Fixes #9240 

Note1: Spreadsheet tabs initial alignment is wrong if the first tab is
not the selected one when Spreadsheet is placed on Dialog. This is not
regression from this PR, but a different bug that needs to be addressed
separately.

Note2: When Spreadsheet is in Dialog, inserting comment does not work.
This is not regression from this PR, as inserting comment after this PR
still works, when Spreadsheet is not in Dialog. This is different bug
that needs to be address separately.

- Actually these bugs happen also with Vaadin 24.10, so they are not
regressions from Dialog's native popover refactor.
The overlay container was a global singleton attached to <body>,
originally because spreadsheet overlays needed to escape clipping
by ancestor elements. With native popover (#9241) overlays render
in the top layer regardless of DOM position, so body-attachment is
no longer required.

Move the container into the <vaadin-spreadsheet> light DOM (one
per instance, projected via a new "overlays" slot). Pass the
container reference through the JS→GWT chain instead of looking it
up by id, and let SpreadsheetConnector — not ApplicationConnection
— own the SpreadsheetContextMenu.

As a side effect, spreadsheet overlays inside a modal Dialog are
now interactive — they inherit pointer-events: auto from the
dialog's overlay part instead of pointer-events: none from <body>.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vaadin vaadin deleted a comment from github-actions Bot May 19, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
11.6% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants