@@ -164,26 +164,28 @@ export class FocusTrap {
164164 */
165165 private _getRegionBoundary ( bound : 'start' | 'end' ) : HTMLElement | null {
166166 // Contains the deprecated version of selector, for temporary backwards comparability.
167- let markers = this . _element . querySelectorAll (
167+ const markers = this . _element . querySelectorAll (
168168 `[cdk-focus-region-${ bound } ], ` + `[cdkFocusRegion${ bound } ], ` + `[cdk-focus-${ bound } ]` ,
169169 ) as NodeListOf < HTMLElement > ;
170170
171- for ( let i = 0 ; i < markers . length ; i ++ ) {
172- // @breaking -change 8.0.0
173- if ( markers [ i ] . hasAttribute ( `cdk-focus-${ bound } ` ) ) {
174- console . warn (
175- `Found use of deprecated attribute 'cdk-focus-${ bound } ', ` +
176- `use 'cdkFocusRegion${ bound } ' instead. The deprecated ` +
177- `attribute will be removed in 8.0.0.` ,
178- markers [ i ] ,
179- ) ;
180- } else if ( markers [ i ] . hasAttribute ( `cdk-focus-region-${ bound } ` ) ) {
181- console . warn (
182- `Found use of deprecated attribute 'cdk-focus-region-${ bound } ', ` +
183- `use 'cdkFocusRegion${ bound } ' instead. The deprecated attribute ` +
184- `will be removed in 8.0.0.` ,
185- markers [ i ] ,
186- ) ;
171+ if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
172+ for ( let i = 0 ; i < markers . length ; i ++ ) {
173+ // @breaking -change 8.0.0
174+ if ( markers [ i ] . hasAttribute ( `cdk-focus-${ bound } ` ) ) {
175+ console . warn (
176+ `Found use of deprecated attribute 'cdk-focus-${ bound } ', ` +
177+ `use 'cdkFocusRegion${ bound } ' instead. The deprecated ` +
178+ `attribute will be removed in 8.0.0.` ,
179+ markers [ i ] ,
180+ ) ;
181+ } else if ( markers [ i ] . hasAttribute ( `cdk-focus-region-${ bound } ` ) ) {
182+ console . warn (
183+ `Found use of deprecated attribute 'cdk-focus-region-${ bound } ', ` +
184+ `use 'cdkFocusRegion${ bound } ' instead. The deprecated attribute ` +
185+ `will be removed in 8.0.0.` ,
186+ markers [ i ] ,
187+ ) ;
188+ }
187189 }
188190 }
189191
@@ -207,7 +209,10 @@ export class FocusTrap {
207209
208210 if ( redirectToElement ) {
209211 // @breaking -change 8.0.0
210- if ( redirectToElement . hasAttribute ( `cdk-focus-initial` ) ) {
212+ if (
213+ ( typeof ngDevMode === 'undefined' || ngDevMode ) &&
214+ redirectToElement . hasAttribute ( `cdk-focus-initial` )
215+ ) {
211216 console . warn (
212217 `Found use of deprecated attribute 'cdk-focus-initial', ` +
213218 `use 'cdkFocusInitial' instead. The deprecated attribute ` +
0 commit comments