Skip to content

Only emit dev tools markup when debug mode is enabled - #118

Merged
marcoroth merged 2 commits into
mainfrom
fix-validation-hint-in-emails
Aug 8, 2026
Merged

Only emit dev tools markup when debug mode is enabled#118
marcoroth merged 2 commits into
mainfrom
fix-validation-hint-in-emails

Conversation

@marcoroth

@marcoroth marcoroth commented Aug 8, 2026

Copy link
Copy Markdown
Owner

This pull request fixes the ReActionView dismiss hint rendering as visible text at the top of production emails.

reactionview_dev_tools_markup gated its meta tags and the dev tools script tag on debug_mode_enabled?, but the dismiss hint sat outside that block, gated only on the validation mode:

if ::ReActionView.config.debug_mode_enabled?
  markup << # meta tags + <script src="reactionview-dev-tools.umd.js">
end

if ::ReActionView.config.validation_mode == :overlay
  markup << %(<template data-herb-dismiss-hint>You can also disable this overlay ...</template>)
end

:overlay is the default outside of test, so with the recommended config.debug_mode = Rails.env.development? the hint was still injected into every layout in production, including layouts/mailer.html.erb.

Browsers never render the contents of a <template>, which is why this was invisible on the web and went unnoticed. Email clients do not implement <template>, so they discard the tag and keep the text inside it and display it.

Resolves #95

`reactionview_dev_tools_markup` gated its meta tags and the dev tools script on
`debug_mode_enabled?`, but the `data-herb-dismiss-hint` template was gated only
on `validation_mode == :overlay`. That is the default outside of test, so the
hint was injected into every layout in production, mailer layouts included.

Browsers never render the contents of a `<template>`, so this stayed invisible on
the web. Email clients strip the tag but keep its text, which put "You can also
disable this overlay by setting config.validation_mode = :none" at the top of
production emails.

The hint is only ever read by `getDismissHint()` in `@herb-tools/dev-tools`,
which runs while the dev tools bundle renders an overlay, and that bundle is only
loaded in debug mode. It also falls back to a generic message when the template
is absent, so nothing is lost by leaving it out.

Resolves #95
@marcoroth
marcoroth force-pushed the fix-validation-hint-in-emails branch from 1ccd214 to 732a5bc Compare August 8, 2026 03:50
@marcoroth
marcoroth merged commit 32ab420 into main Aug 8, 2026
24 checks passed
@marcoroth
marcoroth deleted the fix-validation-hint-in-emails branch August 8, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validation_mode warning showing up in production emails.

1 participant