Skip to content

Conversation

@rubinaga
Copy link
Contributor

ConfirmationButton always renders its modal inside a portal, while ConfirmationModal did not.
This inconsistency caused:

  • unpredictable z-index stacking when multiple layered components are open
  • difficulty debugging and forcing stacking contexts
  • different behaviour depending on whether a developer used the modal directly or via ConfirmationButton

This PR introduces an explicit renderInPortal option and makes both components behave consistently.

Done

  • Added renderInPortal prop to ConfirmationModal, allowing consumers to opt-into portal rendering.
  • Changed ConfirmationButton to rely on ConfirmationModal's portal behaviour instead of managing its own wrapper.

Updated and expanded unit tests for:

  • portal / non-portal rendering

No visual changes to the modal itself.

QA

Pinging @canonical/react-library-maintainers for a review.

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • Open ConfirmationModal with and without renderInPortal
  • Inspect the DOM using dev tools:
    • When renderInPortal={true}, the modal should appear outside the app root inside a dynamically created portal node.
    • When renderInPortal={false}, the modal should appear inline where it is rendered.

Percy steps

No visual changes expected

@webteam-app
Copy link

Copy link
Contributor

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

LGTM, keeping defaults as is, so it seems safe to merge.

@edlerd
Copy link
Contributor

edlerd commented Feb 9, 2026

@rubinaga please, can you rebase on the latest main to get a clean history for the merge?

@rubinaga rubinaga force-pushed the feature/confirmation-modal-portal-support branch from b4cde24 to 3f44ebc Compare February 11, 2026 13:33
Copy link
Contributor

@edlerd edlerd left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@rubinaga rubinaga merged commit d8e8dad into main Feb 11, 2026
9 checks passed
@rubinaga rubinaga deleted the feature/confirmation-modal-portal-support branch February 11, 2026 13:40
@github-actions
Copy link

🎉 This PR is included in version 3.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants