@@ -132,9 +132,9 @@ export class FocusTrap {
132
132
* @returns Returns a promise that resolves with a boolean, depending
133
133
* on whether focus was moved successfully.
134
134
*/
135
- focusInitialElementWhenReady ( ) : Promise < boolean > {
135
+ focusInitialElementWhenReady ( options ?: FocusOptions ) : Promise < boolean > {
136
136
return new Promise < boolean > ( resolve => {
137
- this . _executeOnStable ( ( ) => resolve ( this . focusInitialElement ( ) ) ) ;
137
+ this . _executeOnStable ( ( ) => resolve ( this . focusInitialElement ( options ) ) ) ;
138
138
} ) ;
139
139
}
140
140
@@ -144,9 +144,9 @@ export class FocusTrap {
144
144
* @returns Returns a promise that resolves with a boolean, depending
145
145
* on whether focus was moved successfully.
146
146
*/
147
- focusFirstTabbableElementWhenReady ( ) : Promise < boolean > {
147
+ focusFirstTabbableElementWhenReady ( options ?: FocusOptions ) : Promise < boolean > {
148
148
return new Promise < boolean > ( resolve => {
149
- this . _executeOnStable ( ( ) => resolve ( this . focusFirstTabbableElement ( ) ) ) ;
149
+ this . _executeOnStable ( ( ) => resolve ( this . focusFirstTabbableElement ( options ) ) ) ;
150
150
} ) ;
151
151
}
152
152
@@ -156,9 +156,9 @@ export class FocusTrap {
156
156
* @returns Returns a promise that resolves with a boolean, depending
157
157
* on whether focus was moved successfully.
158
158
*/
159
- focusLastTabbableElementWhenReady ( ) : Promise < boolean > {
159
+ focusLastTabbableElementWhenReady ( options ?: FocusOptions ) : Promise < boolean > {
160
160
return new Promise < boolean > ( resolve => {
161
- this . _executeOnStable ( ( ) => resolve ( this . focusLastTabbableElement ( ) ) ) ;
161
+ this . _executeOnStable ( ( ) => resolve ( this . focusLastTabbableElement ( options ) ) ) ;
162
162
} ) ;
163
163
}
164
164
@@ -197,7 +197,7 @@ export class FocusTrap {
197
197
* Focuses the element that should be focused when the focus trap is initialized.
198
198
* @returns Whether focus was moved successfully.
199
199
*/
200
- focusInitialElement ( ) : boolean {
200
+ focusInitialElement ( options ?: FocusOptions ) : boolean {
201
201
// Contains the deprecated version of selector, for temporary backwards comparability.
202
202
const redirectToElement = this . _element . querySelector ( `[cdk-focus-initial], ` +
203
203
`[cdkFocusInitial]` ) as HTMLElement ;
@@ -219,26 +219,26 @@ export class FocusTrap {
219
219
220
220
if ( ! this . _checker . isFocusable ( redirectToElement ) ) {
221
221
const focusableChild = this . _getFirstTabbableElement ( redirectToElement ) as HTMLElement ;
222
- focusableChild ?. focus ( ) ;
222
+ focusableChild ?. focus ( options ) ;
223
223
return ! ! focusableChild ;
224
224
}
225
225
226
- redirectToElement . focus ( ) ;
226
+ redirectToElement . focus ( options ) ;
227
227
return true ;
228
228
}
229
229
230
- return this . focusFirstTabbableElement ( ) ;
230
+ return this . focusFirstTabbableElement ( options ) ;
231
231
}
232
232
233
233
/**
234
234
* Focuses the first tabbable element within the focus trap region.
235
235
* @returns Whether focus was moved successfully.
236
236
*/
237
- focusFirstTabbableElement ( ) : boolean {
237
+ focusFirstTabbableElement ( options ?: FocusOptions ) : boolean {
238
238
const redirectToElement = this . _getRegionBoundary ( 'start' ) ;
239
239
240
240
if ( redirectToElement ) {
241
- redirectToElement . focus ( ) ;
241
+ redirectToElement . focus ( options ) ;
242
242
}
243
243
244
244
return ! ! redirectToElement ;
@@ -248,11 +248,11 @@ export class FocusTrap {
248
248
* Focuses the last tabbable element within the focus trap region.
249
249
* @returns Whether focus was moved successfully.
250
250
*/
251
- focusLastTabbableElement ( ) : boolean {
251
+ focusLastTabbableElement ( options ?: FocusOptions ) : boolean {
252
252
const redirectToElement = this . _getRegionBoundary ( 'end' ) ;
253
253
254
254
if ( redirectToElement ) {
255
- redirectToElement . focus ( ) ;
255
+ redirectToElement . focus ( options ) ;
256
256
}
257
257
258
258
return ! ! redirectToElement ;
0 commit comments