Skip to content

Commit e8addb7

Browse files
authored
fix: define active state styles after focus state (#219)
* define active state after focus state * Change files * ensure hover styles override focus styles --------- Co-authored-by: nicholasrice <nicholasrice@users.noreply.github.com>
1 parent 11b3f88 commit e8addb7

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Define order of interactivity states as focus - hover - active",
4+
"packageName": "@adaptive-web/adaptive-ui",
5+
"email": "nicholasrice@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/adaptive-ui/src/core/modules/element-styles-renderer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ export class ElementStylesRenderer {
9494
}
9595

9696
if (params.interactive !== undefined) {
97+
if (values.focus) {
98+
selectors.set(
99+
makeSelector(params, InteractiveState.focus),
100+
ElementStylesRenderer.declaration(property, values.focus, InteractiveState.focus)
101+
);
102+
}
97103
if (values.hover) {
98104
selectors.set(
99105
makeSelector(params, InteractiveState.hover),
@@ -106,12 +112,6 @@ export class ElementStylesRenderer {
106112
ElementStylesRenderer.declaration(property, values.active, InteractiveState.active)
107113
);
108114
}
109-
if (values.focus) {
110-
selectors.set(
111-
makeSelector(params, InteractiveState.focus),
112-
ElementStylesRenderer.declaration(property, values.focus, InteractiveState.focus)
113-
);
114-
}
115115
}
116116

117117
if (params.disabled !== undefined && values.disabled) {

0 commit comments

Comments
 (0)