File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
universal-app/kitchen-sink Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,10 @@ export class FocusTrap {
145
145
* @returns The boundary element.
146
146
*/
147
147
private _getRegionBoundary ( bound : 'start' | 'end' ) : HTMLElement | null {
148
+ if ( ! this . _platform . isBrowser ) {
149
+ return null ;
150
+ }
151
+
148
152
// Contains the deprecated version of selector, for temporary backwards comparability.
149
153
let markers = this . _element . querySelectorAll ( `[cdk-focus-region-${ bound } ], ` +
150
154
`[cdk-focus-${ bound } ]` ) as NodeListOf < HTMLElement > ;
@@ -168,6 +172,10 @@ export class FocusTrap {
168
172
* @returns Returns whether focus was moved successfuly.
169
173
*/
170
174
focusInitialElement ( ) : boolean {
175
+ if ( ! this . _platform . isBrowser ) {
176
+ return false ;
177
+ }
178
+
171
179
const redirectToElement = this . _element . querySelector ( '[cdk-focus-initial]' ) as HTMLElement ;
172
180
173
181
if ( redirectToElement ) {
Original file line number Diff line number Diff line change @@ -148,7 +148,8 @@ export class InteractivityChecker {
148
148
function hasGeometry ( element : HTMLElement ) : boolean {
149
149
// Use logic from jQuery to check for an invisible element.
150
150
// See https://github.com/jquery/jquery/blob/master/src/css/hiddenVisibleSelectors.js#L12
151
- return ! ! ( element . offsetWidth || element . offsetHeight || element . getClientRects ( ) . length ) ;
151
+ return ! ! ( element . offsetWidth || element . offsetHeight ||
152
+ ( typeof element . getClientRects === 'function' && element . getClientRects ( ) . length ) ) ;
152
153
}
153
154
154
155
/** Gets whether an element's */
Original file line number Diff line number Diff line change @@ -173,8 +173,9 @@ <h2>Select</h2>
173
173
174
174
< h2 > Sidenav</ h2 >
175
175
< mat-sidenav-container >
176
- < mat-sidenav > On the side</ mat-sidenav >
176
+ < mat-sidenav opened > On the side</ mat-sidenav >
177
177
Main content
178
+ < button > Click me</ button >
178
179
</ mat-sidenav-container >
179
180
180
181
< h2 > Slide-toggle</ h2 >
You can’t perform that action at this time.
0 commit comments