зеркало из https://github.com/microsoft/fast.git
allow toggling the open state by clicking indicator
This commit is contained in:
Родитель
0d592e266e
Коммит
ec7f5f989e
|
@ -248,23 +248,26 @@ export class FASTCombobox extends FormAssociatedCombobox {
|
|||
* @internal
|
||||
*/
|
||||
public clickHandler(e: MouseEvent): boolean | void {
|
||||
if (this.disabled) {
|
||||
const captured = (e.target as HTMLElement).closest(
|
||||
`option,[role=option]`
|
||||
) as FASTListboxOption | null;
|
||||
|
||||
if (this.disabled || captured?.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.open) {
|
||||
const captured = (e.target as HTMLElement).closest(
|
||||
`option,[role=option]`
|
||||
) as FASTListboxOption | null;
|
||||
|
||||
if (!captured || captured.disabled) {
|
||||
if (e.composedPath()[0] === this.control) {
|
||||
this.open = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectedOptions = [captured];
|
||||
this.control.value = captured.text;
|
||||
this.clearSelectionRange();
|
||||
this.updateValue(true);
|
||||
if (captured) {
|
||||
this.selectedOptions = [captured];
|
||||
this.control.value = captured.text;
|
||||
this.clearSelectionRange();
|
||||
this.updateValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
this.open = !this.open;
|
||||
|
|
Загрузка…
Ссылка в новой задаче