Skip to content

Commit cc84a12

Browse files
authored
fix(back-to-top): change background color on hover and focus (#3096)
* fix(back-to-top): change background color on hover and focus Apply hover/focus colors directly rather than through CSS custom property overrides that don't cascade into shadow DOM. Closes #2743 Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: changeset
1 parent 5e1764b commit cc84a12

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@patternfly/elements": patch
3+
---
4+
5+
`<pf-back-to-top>`: fixed background color during hover and focus.

elements/pf-back-to-top/pf-back-to-top.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ a {
4141
gap: var(--pf-c-button__icon--m-end--MarginLeft, var(--pf-global--spacer--xs, 0.25rem));
4242
}
4343

44-
a:hover {
44+
a:hover,
45+
a:focus {
4546
--pf-c-button--m-primary--Color: var(--pf-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100, #fff));
4647
--pf-c-button--m-primary--BackgroundColor: var(--pf-c-button--m-primary--hover--BackgroundColor, var(--pf-global--primary-color--200, #004080));
4748
}
4849

49-
a:focus {
50-
--pf-c-button--m-primary--Color: var(--pf-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100,#fff));
50+
[part="trigger"]:is(pf-button):hover,
51+
[part="trigger"]:is(pf-button):focus-within {
5152
--pf-c-button--m-primary--BackgroundColor: var(--pf-c-button--m-primary--hover--BackgroundColor, var(--pf-global--primary-color--200, #004080));
53+
--pf-c-button--m-primary--Color: var(--pf-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100, #fff));
5254
}
5355

5456
[part="trigger"][hidden] {

0 commit comments

Comments
 (0)