From 24570cd4385de07a5b8b42be65c5a6fe8211694d Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 22 Feb 2023 17:55:43 +0100 Subject: [PATCH] Let sl-button-group deals with blur and focus handling for our Et2DropDownButton widget --- .../etemplate/Et2DropdownButton/Et2DropdownButton.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts b/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts index 5f9e9fa002..f22f089862 100644 --- a/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts +++ b/api/js/etemplate/Et2DropdownButton/Et2DropdownButton.ts @@ -189,6 +189,16 @@ export class Et2DropdownButton extends Et2widgetWithSelectMixin(Et2Button) { return this.shadowRoot.querySelector("sl-dropdown"); } + + blur() + { + this.shadowRoot.querySelector("sl-button-group")?.dispatchEvent(new Event('blur')); + } + + focus() + { + this.shadowRoot.querySelector("sl-button-group")?.dispatchEvent(new Event('focus')); + } } // @ts-ignore TypeScript is not recognizing that Et2Button is a LitElement