This repository was archived by the owner on May 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
angular_components/lib/material_select
examples/material_select_example/lib Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,11 @@ class MaterialDropdownSelectComponent<T> extends MaterialSelectBase<T>
157157 // Whether a custom label render is used.
158158 bool get hasCustomLabelRenderer => labelFactory != null ;
159159
160+ /// Whether to activate (visually focus but not select) the first available
161+ /// option when the dropdown opens.
162+ @Input ()
163+ bool activateFirstOption = false ;
164+
160165 /// CSS classes from the root element, passed to the popup to allow scoping of
161166 /// mixins.
162167 ///
@@ -348,6 +353,9 @@ class MaterialDropdownSelectComponent<T> extends MaterialSelectBase<T>
348353 // item.
349354 activeModel.activate (selection.selectedValues.first);
350355 }
356+ if (activateFirstOption && activeModel.activeItem == null ) {
357+ activeModel.activateFirst ();
358+ }
351359 }
352360
353361 void _handleNavigationKey (KeyboardEvent event, Function activateFunction) {
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ <h3>Multiple Selection w/ searchbox</h3>
141141 [selection] ="multiSelectModel "
142142 [itemRenderer] ="itemRenderer "
143143 [listAutoFocus] ="false "
144+ [activateFirstOption] ="true "
144145 (visibleChange) ="onDropdownVisibleChange($event) ">
145146 < div header >
146147 < material-select-searchbox
You can’t perform that action at this time.
0 commit comments