From b5da357ede35f6bb29b76a5a239d1f62b03b03f6 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Thu, 11 May 2023 18:23:38 -0700 Subject: [PATCH] enh(NcActions): Navigation link actions Signed-off-by: Christopher Ng --- src/components/NcActions/NcActions.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/NcActions/NcActions.vue b/src/components/NcActions/NcActions.vue index ef4a8acf7b..c02279cb29 100644 --- a/src/components/NcActions/NcActions.vue +++ b/src/components/NcActions/NcActions.vue @@ -960,6 +960,16 @@ export default { action => action?.componentOptions?.tag || action?.componentOptions?.Ctor?.extendOptions?.name ) + const isNavLink = (action) => { + const componentName = action?.componentOptions?.Ctor?.extendOptions?.name ?? action?.componentOptions?.tag + return ( + componentName === 'NcActionLink' + && action?.componentOptions?.propsData?.href?.startsWith(window.location.origin) + ) + } + // Automatically detect whether all actions are website navigation links + const isNav = actions.every(isNavLink) + /** * Filter and list actions that are allowed to be displayed inline */ @@ -1093,7 +1103,7 @@ export default { slot: 'trigger', ref: 'menuButton', attrs: { - 'aria-haspopup': 'menu', + 'aria-haspopup': isNav ? null : 'menu', 'aria-label': this.ariaLabel, 'aria-controls': this.opened ? this.randomId : null, 'aria-expanded': this.opened.toString(), @@ -1123,7 +1133,7 @@ export default { attrs: { id: this.randomId, tabindex: '-1', - role: 'menu', + role: isNav ? null : 'menu', }, }, [ actions,