Skip to content

fix(apollo-wind): anchor dialog close button inside the dialog - #1027

Merged
snuziale merged 1 commit into
mainfrom
fix/wind-dialog-close-button-position
Aug 7, 2026
Merged

fix(apollo-wind): anchor dialog close button inside the dialog#1027
snuziale merged 1 commit into
mainfrom
fix/wind-dialog-close-button-position

Conversation

@snuziale

@snuziale snuziale commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Dialog close button (X) rendered in the top-right corner of the page instead of inside the dialog.

Root cause

Commit d1e3417 ("switch dialog from transform to flex positioning") changed DialogContent from fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] to a plain flex child of DialogOverlay. Dropping fixed left the content statically positioned.

The close button is absolute top-4 right-4, and an absolutely positioned element anchors to its nearest positioned ancestor. With the content static, that became DialogOverlay (fixed inset-0), i.e. the viewport. So top-4 right-4 meant "16px from the top-right of the page."

Measured in the browser before the fix, at 1200px wide: the X sat at top:16, right:1184 while the dialog occupied 344-856 x 442-782, and offsetParent was dialog-overlay.

alert-dialog.tsx and sheet.tsx are unaffected; their content is still fixed.

Changes

Both in packages/apollo-wind/src/components/ui/dialog.tsx:

  1. relative on DialogContent restores it as the containing block, which is what the original fixed variant provided.
  2. cursor-pointer on the close button (plus disabled:cursor-default). Tailwind v4 dropped the browser default cursor: pointer on buttons, which is why this repo's Button variants set it explicitly. The hand-written X never got it, so it did not read as clickable next to the footer buttons.

Validation

Verified in Storybook with Playwright against this branch:

  • X renders inside the dialog at 17px from the top/right edge (16px inset + 1px border); offsetParent is now dialog-content.
  • cursor computes to pointer on the button and its SVG; hit-testing at the X's center returns the button, so the pointer shows on hover.
  • Clicking the X closes the dialog.
  • All 6 dialog stories pass (basic, complex, link, scrollable, sticky-footer, delete-confirmation, no-button): all position: relative, cursor: pointer, inset 17/17.
  • 39 unit tests pass across dialog / alert-dialog / sheet; Biome clean.

Note on stacking context

Since the content also carries z-50, adding relative means it now forms a stacking context (a static element ignores z-index, so it previously did not). This matches the pre-d1e34176 behavior and matches alert-dialog / sheet. Portaled children such as popovers render to body, so they are unaffected.

Follow-up, not in this PR

sheet.tsx:64 has the same missing cursor-pointer on its close button. Its positioning is correct. Left out to keep this PR scoped; happy to fold it in.

🤖 Generated with Claude Code

d1e3417 switched DialogContent from `fixed` + transform centering to a
flex child of DialogOverlay, which left the content statically
positioned. The close button's `absolute top-4 right-4` then resolved
against DialogOverlay (`fixed inset-0`), rendering the X in the
top-right corner of the page instead of the dialog.

Add `relative` to DialogContent to restore it as the containing block.
Also add `cursor-pointer` to the close button: Tailwind v4 dropped the
default pointer cursor on buttons, so the X did not read as clickable
the way the Button variants (which set it explicitly) do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 7, 2026 18:11
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Aug 07, 2026, 11:18:34 AM
apollo-docs Ready Preview · Logs Aug 07, 2026, 11:18:34 AM
apollo-landing Ready Preview · Logs Aug 07, 2026, 11:18:34 AM
apollo-vertex Ready Preview · Logs Aug 07, 2026, 11:18:34 AM

@github-actions github-actions Bot added the size:XS 0-9 changed lines. label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1950 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1720
ISC 89
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.2 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes @uipath/apollo-wind Dialog so the close button (X) positions relative to the dialog content (not the viewport) after the earlier layout change that made DialogContent a static element.

Changes:

  • Add relative to DialogContent so the absolutely positioned close button anchors inside the dialog content.
  • Add cursor-pointer (and disabled:cursor-default) to the close button for correct affordance under Tailwind v4 preflight behavior.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core 43.84 MB 57.45 MB ±0
@uipath/apollo-react 39.1% 7.51 MB 28.87 MB +13 B
@uipath/apollo-wind 42.2% — (2 untracked) 420.6 KB 2.73 MB +52 B
@uipath/ap-chat 85.8% 43.46 MB 56.05 MB ±0

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 14 changed (of 166 compared, 152 unchanged). View report

Baseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs

Updated (PT): Aug 07, 2026, 11:24:56 AM

@snuziale
snuziale merged commit d655a0f into main Aug 7, 2026
40 checks passed
@snuziale
snuziale deleted the fix/wind-dialog-close-button-position branch August 7, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-wind size:XS 0-9 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants