Skip to content

feat(pds-link): add turbo data attribute props#765

Open
andrewdally wants to merge 2 commits into
mainfrom
feat/pds-link-turbo-props
Open

feat(pds-link): add turbo data attribute props#765
andrewdally wants to merge 2 commits into
mainfrom
feat/pds-link-turbo-props

Conversation

@andrewdally

Copy link
Copy Markdown

Description

pds-link renders an <a> inside Shadow DOM. Hotwire Turbo attributes like data-turbo-frame set 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>:

Prop Inner attribute Purpose
turbo data-turbo Enable/disable Turbo Drive
turbo-frame data-turbo-frame Target a Turbo Frame
turbo-action data-turbo-action History action (advance/replace)
turbo-method data-turbo-method HTTP method (post, put, patch, delete)
turbo-confirm data-turbo-confirm Confirmation dialog
turbo-stream data-turbo-stream Accept Turbo Stream responses
turbo-prefetch data-turbo-prefetch Control link prefetching
turbo-preload data-turbo-preload Eager preload into cache

All 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-link in the admin sidebar needs data-turbo-frame and data-turbo on the inner <a>. Native props eliminate the need for the MutationObserver bridge currently used to work around the Shadow DOM boundary.

Prior art: pds-chip already forwards data-turbo-method to its inner anchor for Rails/Turbo compatibility.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • unit tests
  • other: build verification (nx run @pine-ds/core:build succeeds)

10 new spec tests covering:

  • Each prop individually renders its data-* attribute on the inner anchor
  • Omitting all turbo props produces no data-* attributes
  • Multiple turbo props can be combined

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

@github-actions github-actions Bot added the package: core Changes have been made to the Core package label Jun 9, 2026
@andrewdally andrewdally self-assigned this Jun 9, 2026
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for pine-design-system ready!

Name Link
🔨 Latest commit df58450
🔍 Latest deploy log https://app.netlify.com/projects/pine-design-system/deploys/6a282039ece9db0008576f39
😎 Deploy Preview https://deploy-preview-765--pine-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@andrewdally

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe4989c7-b7c5-4a01-a74a-99ee4122d16e

📥 Commits

Reviewing files that changed from the base of the PR and between 90ca9bb and df58450.

📒 Files selected for processing (4)
  • libs/core/src/components.d.ts
  • libs/core/src/components/pds-link/pds-link.tsx
  • libs/core/src/components/pds-link/readme.md
  • libs/core/src/components/pds-link/test/pds-link.spec.tsx

📝 Walkthrough

Walkthrough

This PR adds Turbo Drive support to the PdsLink component by introducing eight new optional props: turbo, turboAction, turboConfirm, turboFrame, turboMethod, turboPrefetch, turboPreload, and turboStream. These props are declared in the component's public interface, implemented as Stencil @Prop() decorators, and rendered as data-turbo* attributes on the underlying anchor element. Supporting changes include type definitions in both Components.PdsLink and LocalJSX.PdsLink interfaces, comprehensive test coverage validating attribute rendering, and documentation of the new properties.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding Turbo data attribute props to the pds-link component.
Description check ✅ Passed The description is comprehensive, includes clear motivation, comprehensive testing info, and all key checklist items are completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pds-link-turbo-props

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

package: core Changes have been made to the Core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant