diff --git a/packages/main/cypress/specs/Select.cy.tsx b/packages/main/cypress/specs/Select.cy.tsx index 54ae56d3906f..aeaff395f997 100644 --- a/packages/main/cypress/specs/Select.cy.tsx +++ b/packages/main/cypress/specs/Select.cy.tsx @@ -1913,3 +1913,59 @@ describe("Select general interaction", () => { .should("be.focused"); }); }); + +describe("Select - active/down state", () => { + it("applies active background on ui5-option while mouse is pressed", () => { + cy.mount( + + ); + + cy.get("[ui5-select]").realClick(); + cy.get("[ui5-select]").should("have.attr", "opened"); + + cy.get("[ui5-select]") + .find("[ui5-option]") + .eq(0) + .realMouseDown() + .then($option => { + const bg = window.getComputedStyle($option[0]).backgroundColor; + expect(bg).not.to.equal("rgba(0, 0, 0, 0)"); + expect(bg).not.to.equal("transparent"); + }); + + cy.get("[ui5-select]") + .find("[ui5-option]") + .eq(0) + .realMouseUp(); + }); + + it("applies active background on ui5-option-custom while mouse is pressed", () => { + cy.mount( + + ); + + cy.get("[ui5-select]").realClick(); + cy.get("[ui5-select]").should("have.attr", "opened"); + + cy.get("[ui5-select]") + .find("[ui5-option-custom]") + .eq(0) + .realMouseDown() + .then($option => { + const bg = window.getComputedStyle($option[0]).backgroundColor; + expect(bg).not.to.equal("rgba(0, 0, 0, 0)"); + expect(bg).not.to.equal("transparent"); + }); + + cy.get("[ui5-select]") + .find("[ui5-option-custom]") + .eq(0) + .realMouseUp(); + }); +}); diff --git a/packages/main/src/ListItemBaseTemplate.tsx b/packages/main/src/ListItemBaseTemplate.tsx index 5af5ef6b3628..93726916589a 100644 --- a/packages/main/src/ListItemBaseTemplate.tsx +++ b/packages/main/src/ListItemBaseTemplate.tsx @@ -1,7 +1,7 @@ import type ListItemBase from "./ListItemBase.js"; -import type { AriaRole } from "@ui5/webcomponents-base/"; +import type { AriaRole, JsxTemplate } from "@ui5/webcomponents-base/"; -export default function ListItemBaseTemplate(this: ListItemBase, hooks?: { listItemContent: () => void }, injectedProps?: { +export default function ListItemBaseTemplate(this: ListItemBase, hooks?: { listItemContent: JsxTemplate }, injectedProps?: { role?: AriaRole, title?: string, }) { @@ -21,7 +21,7 @@ export default function ListItemBaseTemplate(this: ListItemBase, hooks?: { listI onKeyDown={this._onkeydown} onClick={this._onclick} > - { listItemContent.call(this) } + { listItemContent.call(this) as JSX.Element } ); } diff --git a/packages/main/src/themes/ListItemBase.css b/packages/main/src/themes/ListItemBase.css index 832c8d170177..1ef16a18cc19 100644 --- a/packages/main/src/themes/ListItemBase.css +++ b/packages/main/src/themes/ListItemBase.css @@ -34,16 +34,16 @@ } /* hovered */ -:host([actionable]:not([active]):not([selected]):not([ui5-li-group-header]):hover) { +:host([actionable]:not([active]):not(:active):not([selected]):not([ui5-li-group-header]):hover) { background-color: var(--sapList_Hover_Background); } -:host([actionable]:not([active]):not([selected]):not([ui5-li-group-header]):hover) .ui5-li-additional-text { +:host([actionable]:not([active]):not(:active):not([selected]):not([ui5-li-group-header]):hover) .ui5-li-additional-text { text-shadow: var(--sapContent_TextShadow); } /* selected and hovered */ -:host([actionable][selected]:not([active], [data-moving]):hover) { +:host([actionable][selected]:not([active]):not(:active):not([data-moving]):hover) { background-color: var(--sapList_Hover_SelectionBackground); } @@ -51,6 +51,7 @@ :host([active][actionable]:not([data-moving])), :host([active][actionable][selected]:not([data-moving])) { background-color: var(--sapList_Active_Background); + border-bottom-color: var(--sapList_Active_Background); } /* focused */ diff --git a/packages/main/src/themes/OptionBase.css b/packages/main/src/themes/OptionBase.css index 227ba508a016..c4d88a9d6bbe 100644 --- a/packages/main/src/themes/OptionBase.css +++ b/packages/main/src/themes/OptionBase.css @@ -1,4 +1,10 @@ :host { height: var(--_ui5_list_item_dropdown_base_height); --_ui5_list_item_title_size: var(--sapFontSize); +} + +:host(:active[actionable]:not([data-moving])), +:host(:active[actionable][selected]:not([data-moving])) { + background-color: var(--sapList_Active_Background); + border-bottom-color: var(--sapList_Active_Background); } \ No newline at end of file