Skip to content

uikit: center PlAlert close button vertically#1663

Open
PaulNewling wants to merge 4 commits into
mainfrom
MILAB-6368_pl-alert-close-btn-centering
Open

uikit: center PlAlert close button vertically#1663
PaulNewling wants to merge 4 commits into
mainfrom
MILAB-6368_pl-alert-close-btn-centering

Conversation

@PaulNewling
Copy link
Copy Markdown
Contributor

@PaulNewling PaulNewling commented May 29, 2026

What

PlAlert's closeable close button was pinned at top: 10px. That put the 40px button's center at 30px — ~6px below the center of a single-line (~48px) alert, drifting further as the alert grew.

Center the button on the first line of text instead:

&__close-btn {
  position: absolute;
  top: 4px;     // 24px row centre − 20px (half the 40px button)
  right: 12px;
}

The first content row's center sits at 24px (12px padding + half the 24px row). Placing the 40px button's top edge at 24 − 20 = 4px puts its center on that row.

A fixed top — not top: 50% — anchors the X to the first line. On a tall multi-line alert the X stays top-right rather than floating to the vertical middle. (An earlier revision used top: 50%; review feedback asked to keep the multi-line X top-right, hence the first-line anchor.)

top: 4px also matches the existing house pattern: PlDialogModal already pins the same PlCloseModalBtn with top: 4px.

Why

The off-center X showed on every closeable PlAlert. Surfaced on the sequence-properties block (MILAB-6368).

Blast radius

The change touches only .pl-alert__close-btn, which renders only when closeable. Across blocks + core there are 157 PlAlert usages; 2 are closeable — sequence-properties and clonotype-enrichment — and both improve. Non-closeable PlAlerts and the separate PlNotificationAlert (its own closable/CSS) stay untouched.

Verification

Built @milaboratories/uikit and previewed live in the sequence-properties dev block. The X-center sits ~24px from the alert top regardless of height:

Alert X vs block center
1 line centered (delta 0)
2 lines 8px above middle (on line 1)
8 lines 68px above middle (on line 1)

Changeset: @milaboratories/uikit: patch — auto-propagates a @platforma-sdk/ui-vue patch (workspace:* + updateInternalDependencies: patch), so blocks pick up the fix on their next ui-vue bump.

@notion-workspace
Copy link
Copy Markdown

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: 54bc1de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@milaboratories/uikit Patch
@platforma-sdk/ui-vue Patch
@milaboratories/milaboratories.monetization-test.ui Patch
@milaboratories/milaboratories.pool-explorer.ui Patch
@milaboratories/milaboratories.monetization-test Patch
@milaboratories/milaboratories.pool-explorer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the PlAlert component to vertically center its close button. The reviewer noted that using top: 50% with a transform can cause layout issues on multi-line alerts or alerts with titles, and suggested using top: 12px instead to maintain clean alignment across both single-line and multi-line layouts.

Comment thread lib/ui/uikit/src/components/PlAlert/pl-alert.scss Outdated
@PaulNewling
Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.43%. Comparing base (64ded0f) to head (54bc1de).
⚠️ Report is 116 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1663      +/-   ##
==========================================
- Coverage   53.22%   52.43%   -0.79%     
==========================================
  Files         270      273       +3     
  Lines       15719    16135     +416     
  Branches     3411     3509      +98     
==========================================
+ Hits         8366     8460      +94     
- Misses       6236     6537     +301     
- Partials     1117     1138      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PaulNewling
Copy link
Copy Markdown
Contributor Author

@greptileai

@PaulNewling PaulNewling marked this pull request as ready for review May 29, 2026 15:26
position: absolute;
top: 10px;
// center vertically regardless of alert height (single- or multi-line)
top: 50%;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PlAlert can be more than one line, in this case it will be wrong style

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.

@AStaroverov Which is why I thought using 50 percent would always work, no? It will always be half way

Tested with multi line:
Screenshot 2026-05-29 at 8 32 51 AM

@PaulNewling
Copy link
Copy Markdown
Contributor Author

Alerts after commit cdce7e8

alert_8line alert_1line

@PaulNewling PaulNewling requested a review from AStaroverov May 29, 2026 17:00
Drop the translateY(-50%) transform. top: 4px centres the 40px button on
the first content row (row centre 24px = 12px padding + half the 24px row;
24 - 20 = 4px) and matches PlDialogModal's existing close-button offset.
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.

2 participants