Skip to content

fix: ensure slideout cleanup completes without transition events - #19511

Merged
brandonkelly merged 3 commits into
craftcms:5.xfrom
mvanhorn:fix/9912-slideout-transition-cleanup
Aug 30, 2026
Merged

fix: ensure slideout cleanup completes without transition events#19511
brandonkelly merged 3 commits into
craftcms:5.xfrom
mvanhorn:fix/9912-slideout-transition-cleanup

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Description

Make Slideout transition completion resilient when reduced motion is disabled but an expected transition event never arrives: retain the event-driven path, add a duration-aware fallback that invokes each completion callback exactly once, and treat targets with no effective transition as immediately complete. Track fallback work with the existing transition listeners so _cancelTransitionListeners() cancels both parts when a slideout is reopened or rapidly toggled; this prevents an obsolete close callback from hiding the active shade or container. Keep this logic inside the existing production-used _afterTransition() lifecycle rather than introducing a test-only seam, and preserve the current shade fade and container motion when events fire normally.

Craft.Slideout.close() hides its shade and outer container only from callbacks registered by _afterTransition(). When a browser does not emit the expected transitionend, those callbacks remain pending, leaving an invisible, full-viewport shade with display: block and active pointer events, and preventing the slideout's close lifecycle from finishing. The thread now includes a deterministic Craft.Slideout reproduction on Craft 5.10.13.2 and identifies the missing transition event, although the maintainer could not reproduce it in the same browser version and requested a safe-mode check. There are no assignees, competing PRs, or closed prior attempts in the supplied issue evidence.

Fixes #9912

Related issues

Not applicable to this change.

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

Adds reliable fallback cleanup when slideout transition events are missing.

Changes:

  • Tracks and cancels transition fallback timers.
  • Completes transitions once via event, timeout, or immediate reduced-motion handling.
  • Adds Playwright coverage for cleanup and rapid reopening.

Reviewed changes

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

File Description
src/web/assets/cp/src/js/Slideout.js Implements resilient, cancellable transition completion.
tests-playwright/tests/slideout/index.test.js Tests completion, fallback, reopening, and reduced motion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

# Conflicts:
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
[ci skip]
@brandonkelly
brandonkelly merged commit e64ab39 into craftcms:5.x Aug 30, 2026
@brandonkelly

Copy link
Copy Markdown
Member

Thanks!

@brandonkelly

Copy link
Copy Markdown
Member

Craft 5.11.0 is out with this change. Thanks again!

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.

Opening and closing slideout too fast causes elements on browser not accessible

3 participants