Skip to content

Commit 3f9430c

Browse files
authored
fix(ui5-avatar): revise active state styles (#8474)
This update corrects the unwarranted toggle-like behaviour of the avatar on clicking. It also introduces proper active state styles to enhance the user experience. Fixes: #8309
1 parent 7472265 commit 3f9430c

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

packages/main/src/Avatar.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ class Avatar extends UI5Element implements ITabbable, IAvatarGroupItem {
9292
@property({ type: Boolean })
9393
interactive!: boolean;
9494

95-
/**
96-
* Indicates if the elements is pressed
97-
* @private
98-
*/
99-
@property({ type: Boolean })
100-
pressed!: boolean;
101-
10295
/**
10396
* Defines the name of the UI5 Icon, that will be displayed.
10497
*
@@ -404,7 +397,6 @@ class Avatar extends UI5Element implements ITabbable, IAvatarGroupItem {
404397

405398
_fireClick() {
406399
this.fireEvent("click");
407-
this.pressed = !this.pressed;
408400
}
409401

410402
_getAriaHasPopup() {

packages/main/src/themes/Avatar.css

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,27 @@
1010
opacity: .7;
1111
}
1212

13-
:host(:is([interactive]):not([disabled])) {
13+
:host([interactive]:not([disabled])) {
1414
cursor: pointer;
1515
}
1616

17-
:host(:is([interactive][pressed]):not([hidden])) {
18-
background: var(--sapButton_Active_Background);
17+
:host([interactive]:not([hidden]):active) {
18+
background-color: var(--sapButton_Active_Background);
1919
border-color: var(--sapButton_Active_BorderColor);
2020
color: var(--sapButton_Active_TextColor);
2121
}
2222

23-
:host(:is([interactive][pressed]):not([hidden]):hover) {
24-
background: var(--sapButton_Selected_Hover_Background);
25-
border-color: var(--sapButton_Selected_Hover_BorderColor);
26-
color: var(--sapButton_Selected_TextColor);
27-
}
28-
29-
:host(:is([interactive]):not([hidden]):not([pressed]):not([disabled]):hover) {
23+
:host([interactive]:not([hidden]):not([disabled]):not(:active):hover) {
3024
box-shadow: var(--ui5-avatar-hover-box-shadow-offset);
3125
}
3226

33-
:host(:is([interactive][desktop]):not([hidden])) .ui5-avatar-root:focus-within,
34-
:host(:is([interactive]):not([hidden])) .ui5-avatar-root:focus-visible {
27+
:host([interactive][desktop]:not([hidden])) .ui5-avatar-root:focus-within,
28+
:host([interactive]:not([hidden])) .ui5-avatar-root:focus-visible {
3529
outline: var(--_ui5_avatar_outline);
3630
outline-offset: var(--_ui5_avatar_focus_offset);
3731
}
3832

39-
:host(:is([disabled])) {
33+
:host([disabled]) {
4034
opacity: var(--sapContent_DisabledOpacity);
4135
}
4236

@@ -137,8 +131,8 @@
137131

138132
::slotted(*) {
139133
border-radius: 50%;
140-
width: 100%;
141-
height: 100%;
134+
width: 100%;
135+
height: 100%;
142136
pointer-events: none;
143137
}
144138

0 commit comments

Comments
 (0)