File tree 1 file changed +7
-6
lines changed
src/cdk-experimental/listbox
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
import {
10
+ AfterViewInit ,
10
11
booleanAttribute ,
11
12
computed ,
12
13
contentChildren ,
@@ -54,7 +55,7 @@ import {_IdGenerator} from '@angular/cdk/a11y';
54
55
'(focusin)' : 'onFocus()' ,
55
56
} ,
56
57
} )
57
- export class CdkListbox < V > {
58
+ export class CdkListbox < V > implements AfterViewInit {
58
59
/** The directionality (LTR / RTL) context for the application (or a subtree of it). */
59
60
private readonly _directionality = inject ( Directionality ) ;
60
61
@@ -110,26 +111,26 @@ export class CdkListbox<V> {
110
111
} ) ;
111
112
112
113
/** Whether the listbox has received focus yet. */
113
- private touched = signal ( false ) ;
114
+ private _touched = signal ( false ) ;
114
115
115
116
/** Whether the options in the listbox have been initialized. */
116
- private isViewInitialized = signal ( false ) ;
117
+ private _isViewInitialized = signal ( false ) ;
117
118
118
119
constructor ( ) {
119
120
effect ( ( ) => {
120
- if ( this . isViewInitialized ( ) && ! this . touched ( ) ) {
121
+ if ( this . _isViewInitialized ( ) && ! this . _touched ( ) ) {
121
122
const index = this . items ( ) . findIndex ( i => this . value ( ) . includes ( i . value ( ) ) ) ;
122
123
this . activeIndex . set ( Math . max ( index , 0 ) ) ;
123
124
}
124
125
} ) ;
125
126
}
126
127
127
128
ngAfterViewInit ( ) {
128
- this . isViewInitialized . set ( true ) ;
129
+ this . _isViewInitialized . set ( true ) ;
129
130
}
130
131
131
132
onFocus ( ) {
132
- this . touched . set ( true ) ;
133
+ this . _touched . set ( true ) ;
133
134
}
134
135
}
135
136
You can’t perform that action at this time.
0 commit comments