Skip to content

fix(AlertDialog): preserve default pointer events lock - #2692

Merged
zernonia merged 1 commit into
unovue:v2from
Perdolique:codex/fix-alert-dialog-pointer-events
Jun 16, 2026
Merged

zernonia merged 1 commit into
unovue:v2from
Perdolique:codex/fix-alert-dialog-pointer-events

Conversation

@Perdolique

@Perdolique Perdolique commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This plugs the same boolean-default hole in AlertDialogContent that DialogContent already fixed in #2679 🧩✨ Without it, the wrapper accidentally forwards an absent disableOutsidePointerEvents prop as false, so alert dialogs with an overlay can open with the body locked while the content itself stays non-interactive 😬

  • 🐛 Preserve undefined for absent disableOutsidePointerEvents on AlertDialogContent, letting DialogContentModal keep its default lock behavior
  • ✅ Add regression coverage that confirms alert dialog content receives pointer-events: auto while the body remains locked
  • 🧹 Clean up the alert dialog test mount between cases so teleported layers do not stack up and muddy pointer-event assertions

Why

DialogContent now avoids Vue's boolean prop coercion by defaulting disableOutsidePointerEvents to undefined. AlertDialogContent extends the same props, but still used plain defineProps, so Vue coerced the missing prop to false before forwarding it downstream.

That means DialogContentModal never gets to apply its default true, and DismissableLayer does not mark the active alert dialog content as pointer-interactive. The body can still be locked by the overlay path, leaving the visible buttons looking fine but unable to receive real browser clicks 🧊

This is a small follow-up to #2677 / #2679.

Summary by CodeRabbit

  • Tests

    • Added cleanup hooks and pointer-event behavior validation to AlertDialog test suite.
  • Bug Fixes

    • Improved AlertDialog pointer-event handling to properly respect component prop configurations while maintaining expected modal interaction behavior.

- 🐛 Keep absent disableOutsidePointerEvents undefined when AlertDialogContent forwards props
- ✅ Add coverage for interactive alert dialog content while body is locked
@coderabbitai

coderabbitai Bot commented Jun 10, 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35cca5e3-37f6-4a87-b79f-e9b568f25294

📥 Commits

Reviewing files that changed from the base of the PR and between 43989e8 and b2a8bb4.

📒 Files selected for processing (2)
  • packages/core/src/AlertDialog/AlertDialog.test.ts
  • packages/core/src/AlertDialog/AlertDialogContent.vue

📝 Walkthrough

Walkthrough

AlertDialogContent now explicitly defaults disableOutsidePointerEvents to undefined via withDefaults, preserving Vue's distinction between an explicitly provided false and an absent value. Test infrastructure is reorganized with import consolidation and cleanup hooks, and a new assertion verifies that dialog content remains interactive while document.body has pointer-events disabled.

Changes

Pointer-events prop default and test behavior

Layer / File(s) Summary
Pointer-events prop default and test verification
packages/core/src/AlertDialog/AlertDialogContent.vue, packages/core/src/AlertDialog/AlertDialog.test.ts
AlertDialogContent uses withDefaults(defineProps(...), { disableOutsidePointerEvents: undefined }) to preserve Vue's distinction between false and undefined, allowing DialogContent's modal default to apply when the prop is not explicitly provided. Tests consolidate imports, add afterEach cleanup to unmount components and reset document.body, and introduce a new assertion verifying that when the dialog is open, document.body has pointerEvents set to none while the dialog content element has pointerEvents set to auto.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • unovue/reka-ui#2678: Both PRs adjust disableOutsidePointerEvents behavior and pointer-events handling, with this PR defaulting the AlertDialog prop to undefined while the related PR modifies DismissableLayer watcher cleanup for the same prop.
  • unovue/reka-ui#2679: Both PRs apply the same withDefaults(..., { disableOutsidePointerEvents: undefined }) pattern to dialog content components and add pointer-events assertions.

Poem

🐰 A dialog once fought with its \props\, now undefined takes the leap,
Pointer events dance in alignment, cleanup hooks their vigil keep,
Tests assert what the DOM declares—interactive content stays awake,
While the body rests from pointers' reach, a sensible boundary they make!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(AlertDialog): preserve default pointer events lock' accurately and concisely describes the main change: fixing a bug in AlertDialog where the default pointer events behavior is now properly preserved.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@Perdolique
Perdolique marked this pull request as ready for review June 10, 2026 22:38
@Perdolique

Perdolique commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@zernonia, it is also reproducible here: https://reka-ui.com/docs/components/alert-dialog

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@2692

commit: b2a8bb4

@Perdolique

Copy link
Copy Markdown
Contributor Author

@zernonia, it's a kind of important fix as AlertDialog doesn't work on 2.9.10 (#2702).

@zernonia
zernonia merged commit fa5cf0e into unovue:v2 Jun 16, 2026
7 checks passed
@Perdolique
Perdolique deleted the codex/fix-alert-dialog-pointer-events branch June 16, 2026 04:50
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