A React portal moves a modal to a different place in the DOM, which can let it escape an ancestor that clips or constrains it. It does not remove the modal from its React parent: context and React event propagation still follow the React tree. And a portal only changes placement—it does not provide modal accessibility behavior.
Why is my modal getting clipped?
A modal rendered inside a layout container may be affected by that container’s CSS. For example, an ancestor with overflow: hidden can clip content that extends beyond its bounds. Rendering the modal elsewhere in the DOM can let it appear over the rest of the page. React describes this as one use for createPortal: React’s createPortal reference.
As an Amazon Associate I earn from qualifying purchases.
What does a portal change—and what stays the same?
createPortal(children, domNode, key?) renders its children into the supplied DOM node. That target node must already exist. The portal changes the children’s physical DOM location, not their place in the React tree.
Recommended Free Tools
- DOM placement changes: the content becomes a child of the supplied DOM node, rather than being placed under its usual DOM parent.
- React relationships remain: the content can still use context from its React ancestors, and its React events propagate through the React tree.
This difference matters when a React parent has a click handler even though it is not a DOM ancestor of the portaled content. A click inside the portal can still invoke that parent’s React handler. React documents two ways to address an unwanted propagation: stop propagation inside the portal, or move the portal higher in the React tree. See the React createPortal reference.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
How do I render a modal through a portal?
Create or identify a DOM node outside the disruptive container, then pass that node as the portal target. The target must exist when the portal is rendered.
import { createPortal } from 'react-dom';
function Modal({ children }) {
const target = document.getElementById('modal-root');
if (!target) return null;
return createPortal(children, target);
}
For example, the page can provide a target outside the application area that clips the modal:
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
<div id="app-root"><!-- React application --></div>
<div id="modal-root"></div>
The example handles a missing target by rendering nothing. In an application where the target is required, choose a deliberate failure or loading strategy instead of silently hiding an expected dialog. A portal changes placement; it does not decide when the modal opens, how it closes, or how users interact with it.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsWhat accessibility behavior must a modal provide?
The WAI-ARIA Authoring Practices Guide’s Dialog (Modal) Pattern treats interaction as a separate responsibility from rendering the dialog elsewhere in the DOM.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
- Move focus into the dialog when it opens. The WAI-ARIA pattern states: “When a dialog opens, focus moves to an element inside the dialog.”
- Keep keyboard focus within it. Tab and Shift+Tab should stay within the dialog’s tab sequence while it is open.
- Provide a keyboard close path. The pattern specifies that Escape closes the dialog.
- Give the dialog an accessible name. Use a visible title referenced by
aria-labelledby, or provide anaria-label. - Make the background genuinely unavailable. Mark a dialog modal only if the rest of the page is obscured and interaction with it is prevented.
aria-modaldeclares semantics; it does not itself block background interaction.
For a long or structurally rich dialog, the WAI-ARIA pattern advises considering initial focus on a static element near the beginning instead of automatically focusing the first interactive control. It also cautions against using aria-describedby when that would make complex structured content be announced as one unbroken string.
Is a portal enough to make a modal?
No. A portal can solve a DOM placement problem, such as clipping by an ancestor, while retaining the modal’s React context and event relationships. The modal still needs appropriate focus handling, keyboard behavior, an accessible name, and a background that is actually unavailable to interaction when it is declared modal. React’s guidance is to “Follow the WAI-ARIA Modal Authoring Practices when creating modals.” Read the React createPortal documentation alongside the WAI-ARIA modal dialog pattern.
Quick Recap
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




