diff --git a/src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/app-language-select.element.ts b/src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/app-language-select.element.ts index 87e02b6087a3..c4144bca3bfc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/app-language-select.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/language/app-language-select/app-language-select.element.ts @@ -112,16 +112,9 @@ export class UmbAppLanguageSelectElement extends UmbLitElement { } } - #onLabelClick(event: UUIMenuItemEvent) { - const menuItem = event.target; - const unique = menuItem.dataset.unique; - if (!unique) throw new Error('Missing unique on menu item'); - + #chooseLanguage(unique: string) { this.#appLanguageContext?.setLanguage(unique); this._isOpen = false; - - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore this._popoverElement?.hidePopover(); } @@ -153,7 +146,7 @@ export class UmbAppLanguageSelectElement extends UmbLitElement { label=${ifDefined(language.name)} data-mark="${language.entityType}:${language.unique}" ?active=${language.unique === this._appLanguage?.unique} - @click-label=${this.#onLabelClick}> + @click-label=${() => this.#chooseLanguage(language.unique)}> ${this.#isLanguageReadOnly(language.unique) ? this.#renderReadOnlyTag(language.unique) : nothing} `,