Skip to content

Conversation

@redross
Copy link

@redross redross commented Aug 5, 2025

The warning previously made it look like placing the data-turbo-suppress-warning attribute on the body element would suppress it, but in fact, only the script tag was being checked for this attribute.

Now, data-turbo-suppress-warning on the body element will also suppress the warning.

The script tag check is kept unchanged to avoid breaking existing code.

The warning message has been updated to mention both possibilities (script tag and body tag) as valid places for
data-turbo-suppress-warning.

Before:
Screenshot from 2025-08-05 10-39-45

Notice the data-turbo-suppress-warning attribute already present on the body tag, while the message suggests adding it

After:
Screenshot from 2025-08-05 12-45-18

The body tag no longer has the data-turbo-suppress-warning attribute, because the warning would no longer appear if it had it

The warning previously made it look like placing the
data-turbo-suppress-warning attribute on the body element would suppress
it, but in fact, only the script tag was being checked for this
attribute.

Now, data-turbo-suppress-warning on the body element will also suppress
the warning.

The script tag check is kept unchanged to avoid breaking existing code.

The warning message has been updated to mention both possibilities
(script tag and body tag) as valid places for
data-turbo-suppress-warning.
@redross
Copy link
Author

redross commented Aug 21, 2025

This seems like a very minor/tiny PR, would appreciate if someone from the maintainers list could check it out - shouldn't take much of your time, thanks 🙇

Bonus - merging this would also close #1424 (or the other way around) - so 2 PRs handled with a single review 😄

@redross
Copy link
Author

redross commented Sep 1, 2025

Gentle ping @packagethief 👋

@redross
Copy link
Author

redross commented Sep 15, 2025

Another gentle ping @packagethief

@redross
Copy link
Author

redross commented Oct 29, 2025

@jorgemanrubia any chance you could take a look?

@packagethief
Copy link
Contributor

Thanks @redross. I'd prefer if we only supported data-turbo-suppress-warning on script elements. On the body element the instruction is ambiguous: suppress a warning about what?

The error message is definitely wrong, though. I'd be happy to accept a change that fixes just that. The bug is that the warning message is assuming element is the current script element, but it's not. We're overwriting element while traversing upward to find the body. To get the script element reference, we can use document.currentScript instead.

Do you want to make that change?

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.

2 participants