Skip to content

Commit 2ab2926

Browse files
committed
fix(select): Selects now close regardless of searchability when caret clicked
Closes #118
1 parent 66b1be4 commit 2ab2926

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

components/select/multi-select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { customValueAccessorFactory, CustomValueAccessor, ICustomValueAccessorHo
1111
@Component({
1212
selector: "sui-multi-select",
1313
template: `
14-
<i class="dropdown icon"></i>
14+
<i class="dropdown icon" (click)="onCaretClick($event)"></i>
1515
<!-- Multi-select labels -->
1616
<sui-multi-select-label *ngFor="let selected of selectedOptions;" [value]="selected"></sui-multi-select-label>
1717
<!-- Query input -->

components/select/select-base.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,16 @@ export abstract class SuiSelectBase<T, U> implements AfterContentInit {
193193
return options.find(o => value === this.valueGetter(o));
194194
}
195195

196+
public onCaretClick(e:HandledEvent):void {
197+
if (!e.eventHandled) {
198+
e.eventHandled = true;
199+
200+
this.dropdownService.setOpenState(!this.dropdownService.isOpen);
201+
}
202+
}
203+
196204
@HostListener("click", ["$event"])
197-
public onClick(e:HandledEvent & MouseEvent):void {
205+
public onClick(e:HandledEvent):void {
198206
if (!e.eventHandled) {
199207
e.eventHandled = true;
200208

components/select/select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type SingleItemLookup<T, U> = (query:string, initial?:U) => Promise<T>;
88
@Component({
99
selector: "sui-select",
1010
template: `
11-
<i class="dropdown icon"></i>
11+
<i class="dropdown icon" (click)="onCaretClick($event)"></i>
1212
<!-- Query input -->
1313
<input [hidden]="!isSearchable"
1414
class="search"

0 commit comments

Comments
 (0)