Et2TreeDropdown: Open option list on space

This commit is contained in:
nathan 2024-10-10 10:35:50 -06:00
parent 6bf85f7808
commit 3376ed3fc4

View File

@ -575,7 +575,7 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
} }
} }
private handleSearchFocus() private handleSearchFocus(event)
{ {
this.hasFocus = true; this.hasFocus = true;
// Should not be needed, but not firing the update // Should not be needed, but not firing the update
@ -584,7 +584,11 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
// Reset tags to not take focus // Reset tags to not take focus
this.setCurrentTag(null); this.setCurrentTag(null);
this.show(); // Don't show if only tabbed into
if(!event.relatedTarget)
{
this.show();
}
} }
private handleInternalBlur(event) private handleInternalBlur(event)
@ -613,11 +617,12 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
event.stopPropagation(); event.stopPropagation();
return; return;
} }
// Show options if popup is closed // Show options if popup is closed on arrow down or space
if(event.key == "ArrowDown" && !this.open && !this.resultsOpen) if((event.key == "ArrowDown" || event.key == " " && this._searchNode.value == "") && !this.open && !this.resultsOpen)
{ {
this.show(); this.show();
event.stopPropagation(); event.stopPropagation();
event.preventDefault();
} }
// Move to tree if popup is open & tree is showing // Move to tree if popup is open & tree is showing
else if(event.key == "ArrowDown" && this.treeOrSearch == "tree") else if(event.key == "ArrowDown" && this.treeOrSearch == "tree")
@ -754,7 +759,7 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
{ {
placeholder = ""; placeholder = "";
} }
else if(this.open) else if(this.hasFocus)
{ {
placeholder = this.egw().lang("Search"); placeholder = this.egw().lang("Search");
} }
@ -931,6 +936,7 @@ export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidg
placement=${this.placement || "bottom"} placement=${this.placement || "bottom"}
strategy="fixed" strategy="fixed"
?disabled=${this.disabled} ?disabled=${this.disabled}
@sl-after-hide=${() => {this.resultsOpen = false;}}
> >
<div <div
part="combobox control" part="combobox control"