feat(pds-link): add turbo data attribute props#765
Conversation
✅ Deploy Preview for pine-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds Turbo Drive support to the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
pds-linkrenders an<a>inside Shadow DOM. Hotwire Turbo attributes likedata-turbo-frameset on the host<pds-link>element don't cross the Shadow DOM boundary, so Turbo can't intercept clicks. This forces consumers to write fragile JavaScript bridges that reach into the shadow root after hydration.This PR adds 8 new optional props that forward Turbo
data-*attributes to the inner<a>:turbodata-turboturbo-framedata-turbo-frameturbo-actiondata-turbo-actionturbo-methoddata-turbo-methodturbo-confirmdata-turbo-confirmturbo-streamdata-turbo-streamturbo-prefetchdata-turbo-prefetchturbo-preloaddata-turbo-preloadAll props are optional — omitting them produces no attributes on the inner anchor. Existing usage is unaffected.
Motivation: kajabi-products is rolling out Turbo Frame navigation in the admin (see spike PR). Every
pds-linkin the admin sidebar needsdata-turbo-frameanddata-turboon the inner<a>. Native props eliminate the need for the MutationObserver bridge currently used to work around the Shadow DOM boundary.Prior art:
pds-chipalready forwardsdata-turbo-methodto its inner anchor for Rails/Turbo compatibility.Type of change
How Has This Been Tested?
nx run @pine-ds/core:buildsucceeds)10 new spec tests covering:
data-*attribute on the inner anchordata-*attributesChecklist: