@@ -119,12 +119,43 @@ globally cause input errors to show when the input is dirty and invalid.
119
119
```
120
120
121
121
### Keyboard interaction
122
+
122
123
- <kbd >DOWN_ARROW</kbd >: Focus next option
123
124
- <kbd >UP_ARROW</kbd >: Focus previous option
124
125
- <kbd >ENTER</kbd > or <kbd >SPACE</kbd >: Select focused item
125
126
126
127
### Accessibility
128
+
127
129
The select component without text or label should be given a meaningful label via
128
130
` aria-label ` or ` aria-labelledby ` .
129
131
130
132
The select component has ` role="listbox" ` and options inside select have ` role="option" ` .
133
+
134
+ ### Troubleshooting
135
+
136
+ #### Error: Cannot change ` multiple ` mode of select after initialization
137
+
138
+ This error is thrown if you attempt to bind the ` multiple ` property on ` <mat-select> ` to a dynamic
139
+ value. (e.g. ` [multiple]="isMultiple" ` where the value of ` isMultiple ` changes over the course of
140
+ the component's lifetime). If you need to change this dynamically, use ` ngIf ` or ` ngSwitch ` instead:
141
+
142
+ ``` html
143
+ <mat-select *ngIf =" isMultiple" multiple >
144
+ ...
145
+ </mat-select >
146
+ <mat-select *ngIf =" !isMultiple" >
147
+ ...
148
+ </mat-select >
149
+ ```
150
+
151
+ #### Error: Cannot assign truthy non-array value to select in ` multiple ` mode
152
+
153
+ This error is thrown if you attempt to assign a value other than ` null ` , ` undefined ` , or an array to
154
+ a ` <mat-select multiple> ` . For example, something like ` mySelect.value = 'option1' ` . What you likely
155
+ meant to do was ` mySelect.value = ['option1'] ` .
156
+
157
+ #### Error: Cannot assign a non-function value to ` compareWith `
158
+
159
+ This error occurs if you attempt to assign something other than a function to the ` compareWith `
160
+ property. For more information on proper usage of ` compareWith ` see the
161
+ [ angular forms documentation] ( https://angular.io/api/forms/SelectControlValueAccessor#caveat-option-selection ) ).
0 commit comments