Skip to content

Commit

Permalink
fix(ui5-select): custom value state message is now visible
Browse files Browse the repository at this point in the history
When open a select wiht custom value state message and press "ESC" key
the custom value state message remains visible.

Fixes: #10323
  • Loading branch information
plamenivanov91 committed Jan 23, 2025
1 parent d0d3cc5 commit be20791
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions packages/main/cypress/specs/Select.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@ describe("Select - Accessibility", () => {
.should("have.attr", "title", EXPECTED_TOOLTIP);
});
});

describe("Select - Popover", () => {
it("Popover should render custom value state", () => {
cy.mount(html`
<ui5-select id="warningSelect" value-state="Critical">
<ui5-option>This option has text bigger than ui5-select's width</ui5-option>
<div slot="valueStateMessage">Custom message</div>
</ui5-select>
`);

cy.get("#warningSelect").realClick().realPress("Escape");

cy.get("#warningSelect")
.find("[slot=\"valueStateMessage\"]")
.should("be.visible")
.should("have.text", "Custom message");
});
});
4 changes: 2 additions & 2 deletions packages/main/src/SelectPopoverTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function SelectPopoverTemplate(this: Select) {
"ui5-select-value-state-dialog-header": true,
...this.classes.popoverValueState
}}>
{valueStateMessage.call(this)}
{this._isPickerOpen && valueStateMessage.call(this)}
</div>
}
</div>
Expand All @@ -56,7 +56,7 @@ export default function SelectPopoverTemplate(this: Select) {
<Icon
class="ui5-input-value-state-message-icon"
name={this._valueStateMessageInputIcon} />
{valueStateMessage.call(this)}
{this._isPickerOpen && valueStateMessage.call(this)}
</div>
}

Expand Down

0 comments on commit be20791

Please sign in to comment.