Skip to content

fix titleless Admonition alignment - #48784

Merged
dnywh merged 3 commits into
masterfrom
dnywh/fix-titleless-admonition-alignment
Aug 7, 2026
Merged

dnywh merged 3 commits into
masterfrom
dnywh/fix-titleless-admonition-alignment

Conversation

@dnywh

@dnywh dnywh commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

UI bug fix.

What is the current behavior?

Titleless Admonitions using the description prop place their compact body text slightly too high beside the icon. Admonition bodies also inherit a 2px bottom margin from AlertDescription, making the vertical spacing subtly uneven.

What is the new behavior?

Titleless description content 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 AlertDescription primitive.

Before After
CleanShot 2026-08-05 at 17 52 34@2x CleanShot 2026-08-06 at 12 05 18@2x
Note the imbalanced space under the text Note how the text is balanced vertically to the icon

To test

Summary by CodeRabbit

  • Bug Fixes

    • Improved admonition spacing for descriptions and MDX content.
    • Removed unintended bottom spacing within admonition bodies.
    • Adjusted vertical spacing for untitled admonitions while preserving titled content layout.
  • Tests

    • Added coverage for paragraph spacing, wrapper structure, and title-specific styling.

@vercel

vercel Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview Aug 6, 2026 3:32am
docs Ready Ready Preview, v0 Aug 6, 2026 3:32am
studio-self-hosted Ready Ready Preview Aug 6, 2026 3:32am
studio-staging Ready Ready Preview Aug 6, 2026 3:32am
ui-library Ready Ready Preview Aug 6, 2026 3:32am
zone-www-dot-com Ready Ready Preview, v0 Aug 6, 2026 3:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Aug 6, 2026 3:32am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 93fa82db-196f-4fbb-9159-7316397a0c44

📥 Commits

Reviewing files that changed from the base of the PR and between 8bf7bd0 and caf54be.

📒 Files selected for processing (2)
  • packages/ui-patterns/src/Admonition/Admonition.test.tsx
  • packages/ui-patterns/src/Admonition/Admonition.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/ui-patterns/src/Admonition/Admonition.test.tsx
  • packages/ui-patterns/src/Admonition/Admonition.tsx

📝 Walkthrough

Walkthrough

The 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.

Changes

Admonition spacing

Layer / File(s) Summary
Admonition spacing behavior and validation
packages/ui-patterns/src/Admonition/Admonition.tsx, packages/ui-patterns/src/Admonition/Admonition.test.tsx
The body removes its bottom margin. Untitled descriptions with icons receive vertical spacing. Tests verify string descriptions, MDX children, titled content, and hidden-icon content.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing alignment for titleless Admonitions.
Description check ✅ Passed The description explains the bug, new behavior, visual impact, screenshots, and testing steps; only the template acknowledgement is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dnywh/fix-titleless-admonition-alignment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Aug 6, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added regression coverage for description-only, children-only, and titled states.

)}
>
<div>
<div className={cn(!title && (description || children) && 'my-0.5')}>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This essentially restores intentional behaviour from #45618 that was lost across #48112 and #48428.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.5 wrapper class for titleless content in Admonition.
  • Extend Admonition tests 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.

@dnywh
dnywh marked this pull request as ready for review August 6, 2026 02:30
@dnywh
dnywh requested a review from a team as a code owner August 6, 2026 02:30
@dnywh
dnywh requested a review from Copilot August 6, 2026 02:30

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'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')}>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +158 to +167
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')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion protects the Docs regression: rich MDX children must not receive the compact-description offset.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@dnywh
dnywh merged commit df35577 into master Aug 7, 2026
38 checks passed
@dnywh
dnywh deleted the dnywh/fix-titleless-admonition-alignment branch August 7, 2026 00:47
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1786063838)

Score Average Improvements Regressions
Completeness 97.7% (-1pp) 1 🟢 2 🔴
Conciseness 40.8% (+1pp) 7 🟢 6 🔴
Correctness 71.1% (+4pp) 3 🟢 3 🔴
Docs Faithfulness 67.7% (+2pp) 4 🟢 2 🔴
Goal Completion 79.9% (-2pp) 4 🟢 3 🔴
Tool Usage 66% (-8pp) - 3 🔴
Knowledge Usage 92.3% (-5pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 100% (+0pp) - -
URL Validity 100% (+0pp) - -
Time_to_first_token 3.19tok (+0.17tok) 10 🟢 19 🔴
Llm_calls 7.2 (-0.48) 8 🟢 17 🔴
Tool_calls 2.97 (-0.16) 8 🟢 14 🔴
Errors 0 (-0.02) 1 🟢 -
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 24343.26tok (-871.33tok) 12 🟢 14 🔴
Prompt_cached_tokens 7550.53tok (-1606.62tok) 13 🟢 10 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 605.92tok (-5.69tok) 15 🟢 14 🔴
Completion_reasoning_tokens 108.32tok (+3.95tok) 14 🟢 12 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 24949.18tok (-877.02tok) 14 🟢 15 🔴
Estimated_cost 0$ (+0$) 8 🟢 13 🔴
Duration 17.52s (+0.79s) 10 🟢 19 🔴
Llm_duration 11.92s (-1.68s) 18 🟢 11 🔴

hunleyd added a commit that referenced this pull request Aug 8, 2026
…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)
  ...
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.

3 participants