From c94784c66637492965f1a7e2f0199b58778c338e Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 24 Jan 2024 16:08:57 -0800 Subject: [PATCH 1/3] fix(NcAvatar): Remove span wrapper button semantics in favour of internal button components Signed-off-by: Christopher Ng --- src/components/NcActions/NcActions.vue | 13 +++++++++++++ src/components/NcAvatar/NcAvatar.vue | 25 +++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/components/NcActions/NcActions.vue b/src/components/NcActions/NcActions.vue index fe36aa8694..dc5d52cfa2 100644 --- a/src/components/NcActions/NcActions.vue +++ b/src/components/NcActions/NcActions.vue @@ -984,6 +984,7 @@ export default { 'close', 'focus', 'blur', + 'click', ], data() { @@ -1222,6 +1223,17 @@ export default { onBlur(event) { this.$emit('blur', event) }, + onClick(event) { + /** + * Event emitted when the menu toggle button is clicked. + * + * This is e.g. necessary for the NcAvatar component + * which needs to fetch the menu items on click. + * + * @type {PointerEvent} + */ + this.$emit('click', event) + }, }, /** @@ -1420,6 +1432,7 @@ export default { on: { focus: this.onFocus, blur: this.onBlur, + click: this.onClick, }, }, [ h('template', { slot: 'icon' }, [triggerIcon]), diff --git a/src/components/NcAvatar/NcAvatar.vue b/src/components/NcAvatar/NcAvatar.vue index f0b76c6a6e..9bdc7e3580 100644 --- a/src/components/NcAvatar/NcAvatar.vue +++ b/src/components/NcAvatar/NcAvatar.vue @@ -115,16 +115,8 @@ export default { 'avatardiv--with-menu': hasMenu, 'avatardiv--with-menu-loading': contactsMenuLoading }" - :title="tooltip" :style="avatarStyle" - class="avatardiv popovermenu-wrapper" - :tabindex="hasMenu ? '0' : undefined" - :aria-label="avatarAriaLabel" - :role="hasMenu ? 'button' : undefined" - v-on="hasMenu ? { - click: toggleMenu, - keydown: toggleMenu, - } : null"> + class="avatardiv popovermenu-wrapper"> @@ -137,10 +129,12 @@ export default { - + class="action-item action-item__menutoggle" + :aria-label="avatarAriaLabel" + :title="tooltip" + @click="toggleMenu">