Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Resolve the hooks lint failure and add regression coverage for portal child focus timing.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates usePortal to mount portals before child focus effects run and adds a portaled confirmation modal Storybook example.
Changes:
- Uses an isomorphic layout effect for portal mounting.
- Adds a portaled
ConfirmationModalstory.
File summaries
| File | Summary | Findings |
|---|---|---|
src/external/usePortal.ts |
Adjusts portal mounting timing. | Critical: useSSR is invoked at module scope, violating hooks lint rules. Nit: Add regression coverage for descendant focus timing. |
src/components/ConfirmationModal/ConfirmationModal.stories.tsx |
Adds a portaled modal example. | No findings. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jmuzina
marked this pull request as ready for review
September 14, 2026 15:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Done
Updates the
usePortalhook to run its content mounting logic inuseLayoutEffectinstead ofuseEffect.Otherwise, components that render content in a portal and use effects that assume that content has been rendered will run those effects before the portal has mounted. For example:
<Modal>content being mounted after a hook in<Modal>has tried to auto-focus the modal close button, and thus failing to move focus to the modal.This fixes focus not being applied to interactive children of portal elements upon opening. Currently this is:
QA
Pinging @canonical/react-library-maintainers for a review.
Storybook
To see rendered examples of all react-components, run:
QA in your project
from
react-componentsrun:Install the resulting tarball in your project with:
QA steps
Percy steps
Fixes
Fixes: #1366