From a54d2c7c74b20ade0779c102b8d714822d1b44ff Mon Sep 17 00:00:00 2001 From: Amir Ashkan Baghdoust Date: Thu, 21 Nov 2024 10:52:33 +0100 Subject: [PATCH] fix(nav-item): add null check for child element before setting role to menuitem --- .../components/telekom/telekom-nav-item/telekom-nav-item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/components/telekom/telekom-nav-item/telekom-nav-item.tsx b/packages/components/src/components/telekom/telekom-nav-item/telekom-nav-item.tsx index abf898fc15..7b26549d39 100644 --- a/packages/components/src/components/telekom/telekom-nav-item/telekom-nav-item.tsx +++ b/packages/components/src/components/telekom/telekom-nav-item/telekom-nav-item.tsx @@ -71,7 +71,7 @@ export class TelekomNavItem { el.matches('a, button') ); const parentRole = this.hostElement.parentElement?.getAttribute('role'); - if (parentRole === 'menu') { + if (child && parentRole === 'menu') { child.setAttribute('role', 'menuitem'); } }