Skip to content
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
34 changes: 34 additions & 0 deletions packages/fiori/cypress/specs/ShellBar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,40 @@ describe("ButtonBadge in ShellBar", () => {
.should("exist")
.should("have.attr", "text", "42");
});

it("Notification badge and custom-item count badge stay within the ShellBar bounds (#12962)", () => {
cy.mount(
<ShellBar id="shellbar-badge-bounds"
primaryTitle="Product Title"
showNotifications={true}
notificationsCount="99+">
<img slot="logo" src="https://upload.wikimedia.org/wikipedia/commons/5/59/SAP_2011_logo.svg" />
<ShellBarItem id="badged-item" icon="accept" text="Item" count="42" />
</ShellBar>
);

cy.get("#shellbar-badge-bounds").then($sb => {
const sbRect = $sb[0].getBoundingClientRect();

cy.get("#shellbar-badge-bounds")
.shadow()
.find(".ui5-shellbar-bell-button ui5-button-badge[slot='badge']")
.then($badge => {
const bRect = $badge[0].getBoundingClientRect();
expect(bRect.top, "bell badge top >= shellbar top").to.be.at.least(sbRect.top);
expect(bRect.bottom, "bell badge bottom <= shellbar bottom").to.be.at.most(sbRect.bottom);
});

cy.get("#shellbar-badge-bounds")
.shadow()
.find(".ui5-shellbar-custom-item ui5-button-badge[slot='badge']")
.then($badge => {
const bRect = $badge[0].getBoundingClientRect();
expect(bRect.top, "custom-item badge top >= shellbar top").to.be.at.least(sbRect.top);
expect(bRect.bottom, "custom-item badge bottom <= shellbar bottom").to.be.at.most(sbRect.bottom);
});
});
});
});

describe("Keyboard Navigation", () => {
Expand Down
10 changes: 8 additions & 2 deletions packages/fiori/src/themes/ShellBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,17 @@ slot[name="profile"] {
}

.ui5-shellbar-overflow-container-right-child .ui5-shellbar-bell-button [slot="badge"] {
inset-inline-end: var(--_ui5-shellbar-notification-btn-count-offset);
inset-inline-end: var(--_ui5-shellbar-notification-btn-count-offset, 0);
}

.ui5-shellbar-overflow-container-right-child .ui5-shellbar-custom-item [slot="badge"] {
inset-inline-end: var(--_ui5-shellbar-notification-btn-count-offset);
inset-inline-end: var(--_ui5-shellbar-notification-btn-count-offset, 0);
}

.ui5-shellbar-overflow-container-right-child .ui5-shellbar-bell-button [slot="badge"][design="OverlayText"],
.ui5-shellbar-overflow-container-right-child .ui5-shellbar-custom-item [slot="badge"][design="OverlayText"] {
top: var(--_ui5-shellbar-badge-offset, 0);
margin: var(--_ui5-shellbar-badge-margin, -0.5rem);
}

.ui5-shellbar-menu-button {
Expand Down
4 changes: 4 additions & 0 deletions packages/fiori/src/themes/sap_fiori_3/ShellBar-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

:root {
--_ui5_shellbar_button_focused_border: 0.0625rem dotted var(--sapContent_ContrastFocusColor);
/* Badge position adjustment for shorter shellbar height in Quartz theme */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.25rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

:root {
--_ui5_shellbar_logo_outline_color: var(--sapContent_FocusColor);
/* Badge position adjustment for shorter shellbar height in Quartz theme */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.25rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

:root {
--_ui5_shellbar_button_focused_border: 0.125rem dotted var(--sapContent_FocusColor);
/* Badge position adjustment for shorter shellbar height in Quartz theme */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.375rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

:root {
--_ui5_shellbar_button_focused_border: 0.125rem dotted var(--sapContent_FocusColor);
/* Badge position adjustment for shorter shellbar height in Quartz theme */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.375rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
4 changes: 4 additions & 0 deletions packages/fiori/src/themes/sap_horizon/ShellBar-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
--_ui5_shellbar_input_border_radius: 1.125rem;
--_ui5_shellbar_input_focus_border_radius: 1.125rem;
--_ui5_shellbar_input_background_color: var(--sapShell_InteractiveBackground);
/* Notification/count badge position adjustment for the OverlayText badge */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.25rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
--_ui5_shellbar_input_border_radius: 1.125rem;
--_ui5_shellbar_input_focus_border_radius: 1.125rem;
--_ui5_shellbar_input_background_color: var(--sapShell_InteractiveBackground);
/* Notification/count badge position adjustment for the OverlayText badge */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.25rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
--_ui5_shellbar_search_field_background_hover: var(--sapShellColor);
--_ui5_shellbar_search_field_box_shadow_hover: none;
--_ui5_shellbar_menu_button_title_font_size: var(--sapFontHeader5Size);
/* Notification/count badge position adjustment for the OverlayText badge */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.375rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
--_ui5_shellbar_search_field_background_hover: var(--sapShellColor);
--_ui5_shellbar_search_field_box_shadow_hover: none;
--_ui5_shellbar_menu_button_title_font_size: var(--sapFontHeader5Size);
/* Notification/count badge position adjustment for the OverlayText badge */
--_ui5-shellbar-badge-offset: 0.25rem;
--_ui5-shellbar-badge-margin: -0.375rem;
--_ui5-shellbar-notification-btn-count-offset: 0;
}
Loading