Skip to content

fix(ui5-side-navigation): add parent item to submenu #11379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/fiori/cypress/specs/SideNavigation.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,12 @@ describe("Side Navigation Accessibility", () => {
.shadow()
.find(".ui5-menu-rp")
.should("have.attr", "accessible-name", NAVIGATION_MENU_POPOVER_HIDDEN_TEXT.defaultText);

cy.get("#sideNav")
.shadow()
.find(".ui5-side-navigation-overflow-menu [ui5-navigation-menu-item][text='1']")
.find("[ui5-navigation-menu-item][text='1']")
.should("exist");
});
});

Expand Down
18 changes: 17 additions & 1 deletion packages/fiori/src/SideNavigationPopoverTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,34 @@ export default function SideNavigationTemplate(this: SideNavigation) {
tooltip={item._tooltip}
ref={this.captureRef.bind(item)}
>
{(item.children.length && !item.unselectable) ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use item.items.length

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better replace ternary operator with &&

item.items.length > 0 && !item.unselectable && <NavigationMenuItem ...> ... </NavigationMenuItem>

(<NavigationMenuItem
class="ui5-navigation-menu-item-root-parent"
accessibilityAttributes={item.accessibilityAttributes}
text={item.text}
design={item.design}
disabled={item.disabled}
href={item.href}
target={item.target}
title={item.title}
tooltip={item._tooltip}
ref={this.captureRef.bind(item)}
></NavigationMenuItem>)
: undefined
}

{item.items.map(subItem =>
<NavigationMenuItem
accessibilityAttributes={subItem.accessibilityAttributes}
text={subItem.text}
icon={subItem.icon}
design={subItem.design}
disabled={subItem.disabled}
ref={this.captureRef.bind(subItem)}
href={subItem.href}
target={subItem.target}
title={subItem.title}
tooltip={subItem._tooltip}
ref={this.captureRef.bind(subItem)}
/>
)}
</NavigationMenuItem>
Expand Down
4 changes: 4 additions & 0 deletions packages/fiori/src/themes/NavigationMenuItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
height: 0.875rem;
}

:host(.ui5-navigation-menu-item-root-parent)::part(content) {
font-weight: bold;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add font-weight? It is not mentioned in the VD

}

:host([design="Action"]) .ui5-sn-item-external-link-icon {
color: var(--sapButton_TextColor);
}
Expand Down
Loading