Fix share button text wrapping on mobile#146
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
WalkthroughThis change updates the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
Problem
On narrow viewports (mobile), the Share button's label can wrap mid-word inside the
.gh-meta-shareflex container.In post.hbs, the
.gh-meta-sharecontainer isdisplay: flex; justify-content: space-between;with the author/date/reading-time block on the left and the.gh-button-shareon the right. With noflex-shrinkorwhite-spacerule on the button, narrow screens (and longer translated labels — e.g. French "Partager", German "Teilen", etc.) cause the button to be squeezed by its sibling and its text to wrap mid-word inside the pill.Screenshot of the bug, French locale, iPhone Safari, on a post using
show_post_metadata:Solution
Two CSS properties on
.gh-button-share:flex-shrink: 0keeps the button at its intrinsic width so the sibling meta block absorbs the available width and wraps naturally (which it already does cleanly thanks to.gh-article-meta-contentbeing flex/wrap-friendly).white-space: nowrapis belt-and-braces for any future translation longer than the pill's intrinsic width.No HTML change, no breakpoint change, no specificity bump. Desktop layout is unaffected because the button was never wrapping there in the first place.
Alternatives considered
partials/icons/). Cleaner visually on very narrow screens but requires a new icon partial, a JS-less media-query swap, and a discussion on whether to keep the text for a11y. Happy to switch to this approach if preferred — let me know..gh-meta-sharevertically below ~600px. Heavier visual change for what's a minor edge case, and the meta + button row reads well side-by-side once the button stops wrapping.Files
assets/css/screen.css— 2 lines added on.gh-button-shareassets/built/screen.css+.map— rebuilt viagulp buildto match the convention from Add share button #134Browser support
Standard CSS, no new properties. Works everywhere
.gh-button-shareitself works.