Skip to content

Commit dac8183

Browse files
authored
fix(ui5-select): display the selected option's icon (#3348)
Fixes: #3344
1 parent c360443 commit dac8183

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

packages/main/src/Select.hbs

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
id="{{_id}}-select"
55
@click="{{_onclick}}"
66
>
7+
{{#if selectedOptionIcon}}
8+
<ui5-icon
9+
aria-hidden="true"
10+
class="ui5-select-option-icon"
11+
name="{{selectedOptionIcon}}"
12+
dir="{{effectiveDir}}"
13+
></ui5-icon>
14+
{{/if}}
715
<div class="ui5-select-label-root"
816
data-sap-focus-ref
917
tabindex="{{tabIndex}}"

packages/main/src/Select.js

+4
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,10 @@ class Select extends UI5Element {
709709
}
710710
}
711711

712+
get selectedOptionIcon() {
713+
return this.selectedOption.icon;
714+
}
715+
712716
async _getPopover() {
713717
const staticAreaItem = await this.getStaticAreaItemDomRef();
714718
return staticAreaItem.querySelector("[ui5-popover]");

packages/main/src/themes/Select.css

+11
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,22 @@
2727
font-weight: normal;
2828
}
2929

30+
.ui5-select-option-icon {
31+
padding-left: 0.5rem;
32+
color: var(--sapField_TextColor);
33+
align-self: center;
34+
}
35+
3036
:host [dir="rtl"].ui5-select-root .ui5-select-label-root {
3137
padding-left: 0;
3238
padding-right: 0.5rem;
3339
}
3440

41+
:host [dir="rtl"] .ui5-select-option-icon {
42+
padding-right: 0.5rem;
43+
padding-left: 0;
44+
}
45+
3546
:host(:not([disabled])) {
3647
cursor: pointer;
3748
}

0 commit comments

Comments
 (0)