Render emphasis upright inside italic blockquotes - #1215
Conversation
Blockquotes are styled italic, and emphasized text inside them picked up the same font-style, leaving <em> visually indistinguishable from the surrounding quote. Follow the typographic convention of flipping nested emphasis back to upright so it stands out by contrast. The rule targets both plain <em> tags (exported Action Text content) and .lexxy-content__italic (the editor's theme class, which also covers bold+italic runs rendered as <strong class="…__italic">). Fixes basecamp#939
2b06431 to
1994ca1
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes the lack of visual distinction for emphasis inside italic-styled blockquotes by flipping nested emphasis back to upright within Lexxy-rendered content, following standard typography conventions.
Changes:
- Add a nested
blockquoterule inlexxy-content.cssto renderemand.lexxy-content__italicasfont-style: normalinside quotes. - Add a Playwright test covering computed
font-stylefor both semantic<em>and theme-class (.lexxy-content__italic) cases inside blockquotes.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/browser/tests/formatting/blockquote_nested_emphasis.test.js | Adds Playwright coverage asserting nested emphasis renders upright inside italic blockquotes. |
| app/assets/stylesheets/lexxy-content.css | Updates blockquote styling so nested emphasis is visually distinct (upright) within italic quotes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test("renders bold emphasized text upright inside an italic blockquote", async ({ editor }) => { | ||
| await editor.setValue("<blockquote><p>Quoted <strong><em>emphasized</em></strong> text</p></blockquote>") | ||
| await editor.flush() | ||
|
|
||
| const emphasis = editor.content.locator("blockquote .lexxy-content__italic") | ||
|
|
||
| await expect(emphasis).toHaveCSS("font-style", "normal") | ||
| }) |
There was a problem hiding this comment.
Agreed — the bold+italic test now also asserts the surrounding paragraph keeps font-style: italic, same as the first test. Fixed in 2cea824.
Guards against a regression where the blockquote's own italic styling changes and the nested-emphasis test would still pass.
Fixes #939
Blockquotes are styled
font-style: italic, and.lexxy-content__italicapplies the same style — so<em>inside a quote is visually indistinguishable from the surrounding text. This follows the standard typographic convention of flipping nested emphasis back to upright so it stands out by contrast.The new rule targets both:
<em>tags — exported Action Text content carries semantic tags, and hand-authored/imported HTML may have no classes at all.lexxy-content__italic— the editor theme class, which also covers bold+italic runs that render as<strong class="…__italic">with no<em>elementNesting stays inside the existing
:where(.lexxy-content)wrapper, so consumer overrides keep working the same way they do for the other blockquote rules.Tests
Added a Playwright test asserting the computed
font-styleof emphasis inside a blockquote isnormalwhile the quote itself staysitalic, for both the plain-emphasis and bold+italic cases. The test fails onmainand passes with this change.Ran the full Playwright suite on Chromium (609 passed) and Firefox for this test; WebKit couldn't launch locally (missing system libraries), so relying on CI for that project.
yarn lintis clean.