Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spreadsheet panes overlap with sheet when using it in combination with Lit Template/Tabsheet #6932

Closed
astarno-dev opened this issue Dec 12, 2024 · 1 comment · Fixed by #6964

Comments

@astarno-dev
Copy link

Description

Hi,

When adding a spreadsheet to a tab of a tabsheet that is not the default tab, the side panes seem to overlap with the sheet/cells. This causes cells to be hidden behind these panes. This only seems to happen when using Lit Template.

image

Expected outcome

Non overlapping side panels.

Minimal reproducible example

In LitElement (TS):

import {css, html, LitElement} from 'lit-element';
import {customElement, property} from 'lit/decorators.js';

@customElement('example')
export class RequirementRulesView extends LitElement {

  static get styles() {
    return [];
  }

  render() {
    return html`
        <vaadin-tabsheet>
          <vaadin-tabs slot="tabs">
            <vaadin-tab id="some-tab">Some tab</vaadin-tab>
            <vaadin-tab id="spreadsheet-tab">Spreadsheet tab</vaadin-tab>
          </vaadin-tabs>
        
          <div tab="some-tab">This is some placeholder tab</div>
          <div tab="spreadsheet-tab">
           <div id="spreadsheet-container"></id>
          </div>
        </vaadin-tabsheet>

    `;
  }
}

In linked Java class:

@Id("spreadsheet-container")
private Div spreadsheetContainer;

Spreadsheet spreadsheet = new Spreadsheet();
spreadsheetContainer.add(spreadsheet);

Steps to reproduce

When running the minimal example above in a working Vaadin Project, the issue should appear.

Environment

Vaadin version(s): 24.5.8
Java: 21
Spring boot: 3.3.2
OS: Windows

Browsers

No response

@DiegoCardoso
Copy link
Contributor

I verified the issue and was able to reproduce it by attaching a Spreadsheet instance to a container that is styled initially with a display: none value and then changing it to display: block:

Div container = new Div();
container.getStyle().setDisplay(Display.NONE);
container.setSizeFull();
Spreadsheet spreadsheet = new Spreadsheet();
container.add(spreadsheet);
add(new Button("show", e -> {
    container.getStyle().setDisplay(Display.BLOCK);
}), container);

The panels offset calculations are done on attach and the element is initially hidden, which causes the panels to be rendered on the top-left corner of the component.

DiegoCardoso added a commit that referenced this issue Dec 18, 2024
Recalculate sheet position as part of the method triggered by the
`ResizeObserver` configured on the Spreadsheet component. It fixes an
issue where the panes positions are wrongly calculated when the
component is attached to a hidden parent.

Fixes #6932
DiegoCardoso added a commit that referenced this issue Dec 18, 2024
Recalculate sheet position as part of the method triggered by the
`ResizeObserver` configured on the Spreadsheet component. It fixes an
issue where the panes positions are wrongly calculated when the
component is attached to a hidden parent.

Fixes #6932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants