@@ -89,8 +89,57 @@ on how scroll events are detected and dispatched.
8989
9090### The overlay container
9191The ` OverlayContainer ` provides a handle to the container element in which all individual overlay
92- elements are rendered. By default, the overlay container is appended directly to the document body
93- so that an overlay is never clipped by an ` overflow: hidden ` parent.
92+ elements are rendered. By default, the overlay container is appended directly to the document body.
93+
94+ In supported browsers, the CDK renders overlays as native
95+ [ Popover] ( https://developer.mozilla.org/en-US/docs/Web/API/Popover_API ) elements.
96+ The ` OverlayContainer ` acts as the default insertion point for these elements, but because they are
97+ rendered as popovers, the browser automatically promotes them to the top layer. This natively
98+ bypasses ` z-index ` and ` overflow: hidden ` clipping issues without needing complex DOM stacking
99+ workarounds.
100+
101+ If a browser does not support the Popover API, the CDK falls back to the traditional
102+ behavior where appending to the ` OverlayContainer ` is the only way to avoid clipping.
103+
104+ You can explicitly configure the popover behavior using the ` usePopover ` option when creating an
105+ overlay. If you need to globally disable the popover behavior, you can provide the
106+ ` OVERLAY_DEFAULT_CONFIG ` injection token:
107+
108+ ``` ts
109+ import {OVERLAY_DEFAULT_CONFIG } from ' @angular/cdk/overlay' ;
110+
111+ bootstrapApplication (MyApp , {
112+ providers: [
113+ {provide: OVERLAY_DEFAULT_CONFIG , useValue: {usePopover: false }}
114+ ]
115+ });
116+ ```
117+
118+ #### Popover DOM location
119+ When an overlay is rendered as a native popover, it doesn't strictly need to be placed inside the
120+ ` OverlayContainer ` to escape ` overflow: hidden ` containers. The ` FlexibleConnectedPositionStrategy `
121+ allows you to change where the popover is inserted in the DOM via the ` withPopoverLocation() ` method.
122+
123+ This is particularly beneficial for accessibility. By injecting the popover directly next to its
124+ trigger element in the DOM structure, the DOM sequence naturally follows the visual logical order,
125+ while the browser continues to render the popover on top of everything.
126+
127+ If you are using the ` cdkConnectedOverlay ` directive, you can configure this using the
128+ ` cdkConnectedOverlayUsePopover ` input. The supported locations are:
129+ - ` 'global' ` (default): Inserts the popover inside the ` OverlayContainer ` .
130+ - ` 'inline' ` : Inserts the popover in the DOM immediately following its trigger element.
131+ - ` {type: 'parent', element: HTMLElement} ` : Inserts the popover as a child of a specific custom element.
132+
133+ ``` html
134+ <!-- Inserts the overlay popover right next to the trigger button in the DOM -->
135+ <button cdkOverlayOrigin #trigger =" cdkOverlayOrigin" >Open Menu</button >
136+ <ng-template cdkConnectedOverlay
137+ [cdkConnectedOverlayOrigin] =" trigger"
138+ [cdkConnectedOverlayOpen] =" isOpen"
139+ cdkConnectedOverlayUsePopover =" inline" >
140+ <div class =" menu-panel" >Menu content</div >
141+ </ng-template >
142+ ```
94143
95144#### Full-screen overlays
96145The ` FullscreenOverlayContainer ` is an alternative to ` OverlayContainer ` that supports correct
0 commit comments