From a9d0f218a833a63808bd68c5c6c004c442b120ef Mon Sep 17 00:00:00 2001 From: atomiks Date: Tue, 17 Mar 2026 08:12:07 +1100 Subject: [PATCH] [navigation menu] Remove invalid aria-orientation --- .../src/navigation-menu/list/NavigationMenuList.tsx | 11 +++++++---- .../navigation-menu/root/NavigationMenuRoot.test.tsx | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/react/src/navigation-menu/list/NavigationMenuList.tsx b/packages/react/src/navigation-menu/list/NavigationMenuList.tsx index a37936c30f1..d953478be78 100644 --- a/packages/react/src/navigation-menu/list/NavigationMenuList.tsx +++ b/packages/react/src/navigation-menu/list/NavigationMenuList.tsx @@ -66,9 +66,7 @@ export const NavigationMenuList = React.forwardRef(function NavigationMenuList( // but we want to block it in this case. // When nested, skip this handler so arrow keys can reach the parent CompositeRoot. const defaultProps: HTMLProps = nested - ? { - 'aria-orientation': orientation, - } + ? EMPTY_OBJECT : { onKeyDown(event: React.KeyboardEvent) { const shouldStop = @@ -82,7 +80,12 @@ export const NavigationMenuList = React.forwardRef(function NavigationMenuList( }, }; - const props = [dismissProps?.floating || EMPTY_OBJECT, defaultProps, elementProps]; + const props = [ + dismissProps?.floating || EMPTY_OBJECT, + defaultProps, + { 'aria-orientation': undefined }, + elementProps, + ]; // When nested, skip the CompositeRoot wrapper so that triggers can participate // in the parent Content's composite navigation context. Also skip the onKeyDown diff --git a/packages/react/src/navigation-menu/root/NavigationMenuRoot.test.tsx b/packages/react/src/navigation-menu/root/NavigationMenuRoot.test.tsx index 57a01442b33..a8b602518d9 100644 --- a/packages/react/src/navigation-menu/root/NavigationMenuRoot.test.tsx +++ b/packages/react/src/navigation-menu/root/NavigationMenuRoot.test.tsx @@ -831,18 +831,18 @@ describe('', () => { }, })); - it('applies aria-orientation to the top-level list instead of the root element', async () => { + it('does not apply aria-orientation to the top-level list or root element', async () => { await render(); expect(screen.getByTestId('top-level-root')).not.toHaveAttribute('aria-orientation'); - expect(screen.getByTestId('top-level-list')).toHaveAttribute('aria-orientation', 'vertical'); + expect(screen.getByTestId('top-level-list')).not.toHaveAttribute('aria-orientation'); }); - it('applies aria-orientation to nested lists instead of nested root elements', async () => { + it('does not apply aria-orientation to nested lists or root elements', async () => { await render(); expect(screen.getByTestId('nested-root')).not.toHaveAttribute('aria-orientation'); - expect(screen.getByTestId('nested-list')).toHaveAttribute('aria-orientation', 'vertical'); + expect(screen.getByTestId('nested-list')).not.toHaveAttribute('aria-orientation'); }); describe('interactions', () => {