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

Support the case where data-turbo-frame is specified in a link in the shadow DOM #1022

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yuki24
Copy link
Contributor

@yuki24 yuki24 commented Oct 8, 2023

This PR adds support for an a element with the data-turbo-frame attribute within a shadow DOM.

@stedekay has provided a great explanation in #1021, but the TL; DR is that, the following example doesn't work without this patch:

import { html, LitElement } from "lit"

export class LinkElement extends LitElement {
  render() {
    return html`
      <a href="/path/to/link" data-turbo-frame="a-frame">
        <slot></slot>
      </a>
    `
  }
}

customElements.define('custom-link', LinkElement)
<custom-link>
  <!-- #shadow-root -->
  <!-- <a href="/path/to/link" data-turbo-frame="a-frame"></a> -->
</custom-link>
<turbo-frame id="a-frame"></turbo-frame>

closes #1021

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

Successfully merging this pull request may close these issues.

Working Turbo Frames called from the Shadow Dom
1 participant