From 2bef1e26c6dfd5ee81b11f6da76e257861fc0bef Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 24 Mar 2025 18:55:27 +0100 Subject: [PATCH] fix(Link): properly pick all `aria-*` & `data-*` attrs Resolves https://github.com/nuxt/ui-pro/issues/494, resolves #3007 --- src/runtime/utils/link.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/utils/link.ts b/src/runtime/utils/link.ts index 929e070e..cfc9ee44 100644 --- a/src/runtime/utils/link.ts +++ b/src/runtime/utils/link.ts @@ -127,9 +127,11 @@ export const getNuxtLinkProps = (props) => { } export const getULinkProps = (props) => { - const keys = [...Object.keys(nuxtLinkProps), ...Object.keys(uLinkProps), 'ariaLabel', 'title'] + const keys = Object.keys(props) + const ariaKeys = keys.filter(key => key.startsWith('aria-')) + const dataKeys = keys.filter(key => key.startsWith('data-')) - return keys.reduce((acc, key) => { + return [...Object.keys(nuxtLinkProps), ...Object.keys(uLinkProps), ...ariaKeys, ...dataKeys].reduce((acc, key) => { if (props[key] !== undefined) { acc[key] = props[key] }