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

lit-virtualizer in mwc-dialog / Items overlap #81

Open
TomRauchenwald38 opened this issue Dec 4, 2020 · 1 comment
Open

lit-virtualizer in mwc-dialog / Items overlap #81

TomRauchenwald38 opened this issue Dec 4, 2020 · 1 comment

Comments

@TomRauchenwald38
Copy link

When lit-virtualizer is used in a mwc-dialog, the positioning of the rendered items is off sometimes.
I'm using version 0.4.2 and chrome 87.

Test code:

export class TestView extends LitElement {
  render() {
    return html`
    <mwc-dialog id="dialog">
       ${this.renderVirtualizer()}
    </mwc-dialog>    
    <mwc-button @click=${() => this.shadowRoot.getElementById('dialog').show()}>Click</mwc-button>
    ${this.renderVirtualizer()}
    `
  }
  
  renderVirtualizer() {
    return html`<lit-virtualizer style="height: 600px; width: 400px"
       .items=${[1, 2, 3, 4, 5, 6, 7, 8]} 
       .renderItem=${(item) => this.renderItem(item)}
       ></lit-virtualizer>`;
  }
  
  renderItem(item) {
    return html`<div style="height: 200px; border: 1px solid black; width: 300px"><h1>${item}</h1></div>`;
  }
}

I've prepared a demo here: https://codepen.io/TomRauchenwald/pen/NWRxErO

I would expect the lit-virtualizer element that's rendered directly in the component to look the same as the one in the opened dialog.
Instead, the elements overlap in the dialog:
image

@matyaslapincs
Copy link

matyaslapincs commented Jan 25, 2022

I managed to reproduce the issue with version 0.7.0-pre.2. using mdc-menu.
It only appears on the first render. Once the item gets rerendered (after getting scrolled out and then back in the frame) the positioning is correct again.

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

No branches or pull requests

2 participants