diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index fcb8bf38dc..c2c002574a 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -175,6 +175,14 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) multiple: { type: Boolean, reflect: true, + }, + + /** + * Click handler for individual tags instead of the select as a whole. + * Only used if multiple=true so we have tags + */ + onTagClick: { + type: Function, } } } @@ -596,6 +604,11 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) tag.addEventListener("keydown", this.handleTagInteraction); tag.addEventListener("sl-remove", (event : CustomEvent) => this.handleTagRemove(event, item)); } + // Allow click handler even if read only + if(typeof this.onTagClick == "function") + { + tag.addEventListener("click", (e) => this.onTagClick(e, e.target)); + } let image = this._createImage(item); if(image) { diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index ec891274dc..a59c144b67 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -43,13 +43,13 @@ + onTagClick="app.mail.onclickCompose"> + onTagClick="app.mail.onclickCompose">