@@ -71,6 +71,7 @@ export class MdChipListChange {
7171 '[attr.aria-required]' : 'required.toString()' ,
7272 '[attr.aria-disabled]' : 'disabled.toString()' ,
7373 '[attr.aria-invalid]' : 'errorState' ,
74+ '[attr.aria-multiselectable]' : 'true' ,
7475 '[class.mat-chip-list-disabled]' : 'disabled' ,
7576 '[class.mat-chip-list-invalid]' : 'errorState' ,
7677 '[class.mat-chip-list-required]' : 'required' ,
@@ -164,6 +165,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
164165 /** Comparison function to specify which option is displayed. Defaults to object equality. */
165166 private _compareWith = ( o1 : any , o2 : any ) => o1 === o2 ;
166167
168+ /** The array of selected chips inside chip list. */
167169 get selected ( ) : MdChip [ ] {
168170 return this . _selectionModel . selected ;
169171 }
@@ -219,22 +221,23 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
219221 return this . _chipInput ? this . _chipInput . placeholder : this . _placeholder ;
220222 }
221223
222- /** For FormFieldControl. If any of the chips has focus, or the chip input has focus */
224+ /** Whether any chips or the mdChipInput inside of this chip-list has focus. */
223225 get focused ( ) {
224226 return this . chips . some ( chip => chip . _hasFocus ) ||
225227 ( this . _chipInput && this . _chipInput . focused ) ;
226228 }
227229
228- /** For FormFieldControl. The chip list is empty if there's no chip and there's no input */
230+ /** Whether this chip- list contains no chips and no mdChipInput. */
229231 get empty ( ) : boolean {
230232 return ( ! this . _chipInput || this . _chipInput . empty ) && this . chips . length === 0 ;
231233 }
232234
233- /** For FormFieldControl. The disabled is not depend on chip input */
235+ /** Whether this chip-list is disabled. */
234236 @Input ( )
235237 get disabled ( ) { return this . ngControl ? this . ngControl . disabled : this . _disabled ; }
236238 set disabled ( value : any ) { this . _disabled = coerceBooleanProperty ( value ) ; }
237239
240+ /** Whether the chip list is in an error state. */
238241 get errorState ( ) : boolean {
239242 const isInvalid = this . ngControl && this . ngControl . invalid ;
240243 const isTouched = this . ngControl && this . ngControl . touched ;
@@ -584,22 +587,28 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
584587 this . _changeDetectorRef . markForCheck ( ) ;
585588 }
586589
590+ /** When blurred, mark the field as touched when focus moved outside the chip list. */
587591 _blur ( ) {
588592 if ( ! this . disabled ) {
589593 if ( this . _chipInput ) {
590- // Check if focus moved to chip input. If not, do real on blur
594+ // If there's a chip input, we should check whether the focus moved to chip input.
595+ // If the focus is not moved to chip input, mark the field as touched. If the focus moved
596+ // to chip input, do nothing.
597+ // Timeout is needed to wait for the focus() event trigger on chip input.
591598 setTimeout ( ( ) => {
592599 if ( ! this . focused ) {
593- this . _onBlur ( ) ;
600+ this . _markAsTouched ( ) ;
594601 }
595602 } ) ;
596603 } else {
597- this . _onBlur ( ) ;
604+ // If there's no chip input, then mark the field as touched.
605+ this . _markAsTouched ( ) ;
598606 }
599607 }
600608 }
601609
602- _onBlur ( ) {
610+ /** Mark the field as touched */
611+ _markAsTouched ( ) {
603612 this . _onTouched ( ) ;
604613 this . _changeDetectorRef . markForCheck ( ) ;
605614 this . stateChanges . next ( ) ;
0 commit comments