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

Change [data-turbo] guard to [data-turbo-drive] #2

Closed
wants to merge 1 commit into from

Conversation

seanpdoyle
Copy link
Contributor

According to the website's documentation, consumers can disable Turbo
integration for their links by declaring
data-turbo-drive="false".

This commit modifies the guard clause to check the attribute that the
documentation mentions.

According to the website's documentation, consumers can disable Turbo
integration for their links by declaring
[data-turbo-drive="false"][turbo-drive].

This commit modifies the guard clause to check the attribute that the
documentation mentions.

[turbo-drive]: https://turbo.hotwire.dev/handbook/drive#disabling-turbo-drive-on-specific-links
@seanpdoyle seanpdoyle requested review from sstephenson and javan and removed request for sstephenson December 14, 2020 17:36
@javan javan requested review from sstephenson and removed request for javan December 14, 2020 18:07
linkIsVisitable(link: Element) {
const container = closest(link, "[data-turbo]")
turboDriveIsEnabled(link: Element) {
const container = closest(link, "[data-turbo-drive]")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3 adds support for skipping form submissions in the same way that we skip <a> navigations.

Should we check for two attributes: [data-turbo="false] and [data-turbo-drive="false"]? If #3 guards submissions in the same way, does replacing [data-turbo-drive="false"] checks with [data-turbo="false"] make sense?

Re-stated, is the implementation incorrect, or is the documentation incorrect?

@sstephenson
Copy link
Contributor

Actually the docs were written before we decided to go with data-turbo everywhere as the common prefix. Maybe you could make a pass through the reference docs and update anything that doesn't match? Same story for the global object, which is Turbo.

@seanpdoyle
Copy link
Contributor Author

@sstephenson does that apply for attributes like data-turbo-drive-action="replace", or do package-specific names make sense in that context?

@sstephenson
Copy link
Contributor

Yup, just data-turbo-action there, too.

seanpdoyle added a commit to hotwired/turbo-site that referenced this pull request Dec 15, 2020
Replace all references to `TurboDrive.` with `Turbo.`

Replace `data-turbo-drive-*` prefixed attributes with `data-turbo-*`.

[hotwired/turbo#2]: hotwired/turbo#2
[comment]: hotwired/turbo#2 (comment)
@seanpdoyle
Copy link
Contributor Author

Closing in favor of hotwired/turbo-site#2.

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.

None yet

2 participants