allow toggling the open state by clicking indicator

This commit is contained in:
John Kreitlow 2024-03-17 13:44:00 -07:00
Родитель 0d592e266e
Коммит ec7f5f989e
1 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -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;