Wrap generated demo file paths in onboarding page (Part 1 of #4062)#4107
Wrap generated demo file paths in onboarding page (Part 1 of #4062)#4107justin808 wants to merge 1 commit into
Conversation
The generated hello_world onboarding page renders file paths inside <code> elements in the "Inspect these files next" card. The `code` CSS rule had no wrapping properties, so long file paths overflowed their container on narrow viewports. Add `overflow-wrap: anywhere` and `word-break: break-word` to the `code` rule so long paths wrap instead of overflowing. This is Part 1 of #4062 (CSS wrapping). Part 2 (deriving source hints from Shakapacker config) is intentionally deferred as a separate, larger change. Refs #4062 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review: Wrap generated demo file paths (Part 1 of #4062)Summary: This is a minimal, focused CSS fix — 2 lines added to the What's Good
Minor Points
Test CoverageThe spec pass noted in the description is sufficient for this change — the fix is visual and can only be fully validated by rendering the page at a narrow viewport. No unit test could meaningfully cover it. VerdictApproved. The change is correct, minimal, and well-documented. The redundancy of |
What
Adds CSS wrapping to the
coderule in the generated onboarding demo page so long file paths wrap instead of overflowing their container.code { padding: 2px 6px; border-radius: 8px; background: rgba(17, 32, 49, 0.06); color: var(--ink); font-size: 0.95em; + overflow-wrap: anywhere; + word-break: break-word; }File:
lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.ttWhy
The generated
hello_worldonboarding page renders file paths inside<code>elements in the "Inspect these files next" card (<code><%= hint[:path] %></code>). ThecodeCSS rule had no wrapping properties, so long file paths overflowed horizontally on narrow viewports (mobile / small windows), pushing the card out and creating horizontal scroll.Scope: Part 1 of #4062
This PR is Part 1 only — the CSS wrapping fix.
Part 2 is intentionally deferred as a separate, larger change: deriving the displayed source hints from the Shakapacker configuration (rather than hardcoding paths in the template). That work is broader and warrants its own PR. Using
Refs #4062(notFixes) so the issue stays open for Part 2.Codex Decision Log
overflow-wrap: anywhere+word-break: break-wordtogether.overflow-wrap: anywhereallows breaking long unbreakable tokens (like slash-separated paths with no spaces) and, unlikebreak-word, is also considered when computing the min-content intrinsic size — preventing the container itself from overflowing.word-break: break-wordis added as a defensive fallback for older engines. Both are minimal additions scoped strictly to the existingcoderule; no other selectors were touched.Validation
bundle exec rspec spec/react_on_rails/generators/install_generator_spec.rb. The targeted landing-page example passes in isolation (1 example, 0 failures). The full-file run shows pre-existing failures caused by cross-example generated-directory state pollution ("Expected file ... to exist, but does not"), unrelated to this change — none reference thecoderule,overflow-wrap, orword-break..rbfiles changed, so RuboCop was not required.codeblock.Refs #4062
🤖 Generated with Claude Code
Note
Low Risk
Presentation-only change in a generator ERB template; no runtime Ruby or app logic affected.
Overview
Adds
overflow-wrap: anywhereandword-break: break-wordto the inlinecodestyles in the generated hello world onboarding view template so long slash-separated file paths in the “Inspect these files next” hints wrap on narrow viewports instead of overflowing the card.Scoped to the generator template only; new apps get the fix automatically. Part 1 of #4062 (Shakapacker-derived paths deferred).
Reviewed by Cursor Bugbot for commit 9f5e926. Bugbot is set up for automated code reviews on this repo. Configure here.