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

Avoid teleporting nodes in SlotTargetMixin #2609

Closed
tomivirkki opened this issue Sep 22, 2021 · 1 comment · Fixed by #2735
Closed

Avoid teleporting nodes in SlotTargetMixin #2609

tomivirkki opened this issue Sep 22, 2021 · 1 comment · Fixed by #2735
Assignees
Labels
a11y Accessibility issue bug Something isn't working

Comments

@tomivirkki
Copy link
Member

tomivirkki commented Sep 22, 2021

SlotTargetMixin currently teleports nodes assigned to a specific slot. For example, if you create a <vaadin-checkbox> with plain-text -content, the content is teleported inside a generated <label slot="label">. This works to an extent with static text, but with dynamically changing text eg. in a Lit-template, teleporting user-defined content like this doesn't work:

<div id="root"></div>
<button id="render">Render</button>

<script type="module">
  import '@vaadin/checkbox';
  import {render, html} from 'lit';

  const wrapper = document.querySelector('#root');
  const button = document.querySelector('#render');

  let i = 0;
  button.addEventListener('click', () => {
    render(html`
      <vaadin-checkbox>Label ${++i}</vaadin-checkbox>
  `, wrapper);
  });
</script>
@vursen
Copy link
Contributor

vursen commented Sep 22, 2021

Useful links related to the issue

The following PR is where SlotTargetMixin is introduced:

The following PRs are where SlotTargetMixin comes to use:

@tomivirkki tomivirkki added a11y Accessibility issue bug Something isn't working labels Sep 27, 2021
@tomivirkki tomivirkki self-assigned this Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility issue bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants