Repository navigation
fix titleless Admonition alignment - #48784
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe Admonition component now removes body bottom margin and conditionally applies vertical spacing to untitled descriptions. Tests verify string, MDX, titled-content, and hidden-icon class behavior. ChangesAdmonition spacing
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
Added regression coverage for description-only, children-only, and titled states.
| )} | ||
| > | ||
| <div> | ||
| <div className={cn(!title && (description || children) && 'my-0.5')}> |
There was a problem hiding this comment.
Pull request overview
This PR fixes a small visual alignment issue in the shared Admonition component by adding an optical vertical offset for titleless admonitions so their body text aligns better with the (23px) icon. It also updates unit tests to assert the new offset behavior and ensure titled admonitions remain unchanged.
Changes:
- Add a conditional
my-0.5wrapper class for titleless content inAdmonition. - Extend
Admonitiontests to assert the offset is applied for description-only and children-only cases. - Add a regression test ensuring titled admonitions do not receive the offset.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/ui-patterns/src/Admonition/Admonition.tsx | Adds conditional margin wrapper to offset titleless body content. |
| packages/ui-patterns/src/Admonition/Admonition.test.tsx | Updates/extends tests to cover the new offset and a titled-content non-offset case. |
|
|
||
| const admonitionBodyClassName = | ||
| '[&_p]:!mt-0 [&_p]:!mb-1.5 [&_p:last-child]:!mb-0 [&_ul]:!my-1.5 [&_ol]:!my-1.5 [&_li]:!my-0.5' | ||
| '!mb-0 [&_p]:!mt-0 [&_p]:!mb-1.5 [&_p:last-child]:!mb-0 [&_ul]:!my-1.5 [&_ol]:!my-1.5 [&_li]:!my-0.5' |
There was a problem hiding this comment.
This overrides AlertDescription’s 2px bottom margin only inside Admonitions. The Admonition handles its own body, paragraph and action spacing, so retaining that margin made the bottom look slightly heavier.
| )} | ||
| > | ||
| <div> | ||
| <div className={cn(!title && description && 'my-0.5')}> |
There was a problem hiding this comment.
The optical offset is intentionally limited to the description prop. These compact descriptions need the 2px adjustment, whereas MDX children use the taller Docs prose line height and already align naturally.
| expect(paragraph.parentElement?.parentElement).not.toHaveClass('my-0.5') | ||
| }) | ||
|
|
||
| it('does not offset titled content', () => { | ||
| render(<Admonition type="note" title="Manual approval required" description="Body copy." />) | ||
|
|
||
| const note = screen.getByRole('alert', { name: 'Note' }) | ||
| const title = within(note).getByText('Manual approval required') | ||
|
|
||
| expect(title.parentElement).not.toHaveClass('my-0.5') |
There was a problem hiding this comment.
This assertion protects the Docs regression: rich MDX children must not receive the compact-description offset.
Braintrust eval report
|
…for-pitr-archiving-stale * origin/master: (342 commits) feat(studio): role-aware access feedback in scoped token creation (#48858) Initialize notebook editor page (#48842) test(docs): scan changed pages for WCAG 2.1 A/AA in warn mode (#48727) docs(auth): clarify audit logs storage options and configuration (#48852) feat(studio): warn that scoped tokens don't support the MCP server (#48849) feat(studio): lifecycle and role-aware scoped token view sheet (#48848) feat(www): add Open Authorization Integration Addendum (#48804) feat(studio): add legacy token mode to scoped pat creation flow (#48844) Add blog post: Supabase is now a connector on Perplexity Computer (#48776) feat(studio): enforce expiry scoped pat (#48811) fix(studio): model scoped pat permissions as OR-of-AND alternatives - smaller version (#48809) fix(ui): opaque default button hover fills (#48837) fix(ui): restore normal alert text wrapping (#48840) feat: notebook content schema (#48813) fix(ui): remove extra spacing before custom reports section (#48796) feat(marketing): add hint text below Go page form labels (#48824) Initialize notebooks store (#48801) Use white wordmark for QA.tech primary logo (#48827) fix titleless Admonition alignment (#48784) fix inconsistent product menu dividers (#48787) ...
What kind of change does this PR introduce?
UI bug fix.
What is the current behavior?
Titleless Admonitions using the
descriptionprop place their compact body text slightly too high beside the icon. Admonition bodies also inherit a 2px bottom margin fromAlertDescription, making the vertical spacing subtly uneven.What is the new behavior?
Titleless
descriptioncontent receives a small optical offset, centring a one-line description beside the icon. Rich MDX children retain their natural top alignment because Docs prose uses a taller line height.Admonition bodies also remove the inherited 2px bottom margin, balancing the surrounding space without changing the shared
AlertDescriptionprimitive.To test
Summary by CodeRabbit
Bug Fixes
Tests