Skip to content

Commit d820c86

Browse files
authored
Merge pull request #44799 from github/repo-sync
Repo sync
2 parents 64e44f6 + d76d891 commit d820c86

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/frame/components/ui/ScrollButton/ScrollButton.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
.opacity0 {
66
opacity: 0;
7+
pointer-events: none;
78
}
89

910
.opacity100 {
1011
opacity: 1;
12+
pointer-events: auto;
1113
}
1214

1315
.customFocus:focus:not(:focus-visible), // override primer css specificity
@@ -21,3 +23,10 @@
2123
width: 2.5rem;
2224
height: 2.5rem;
2325
}
26+
27+
// When the viewport is too short to show the button permanently,
28+
// reveal it on keyboard focus so it remains accessible (a11y #16466).
29+
.scrollWrapper:has(.scrollButton:focus-visible) {
30+
opacity: 1;
31+
pointer-events: auto;
32+
}

src/frame/components/ui/ScrollButton/ScrollButton.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,17 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
6464
return (
6565
<div
6666
role="tooltip"
67-
className={cx(className, transition200, isVisible ? opacity100 : opacity0)}
68-
aria-hidden={!isVisible}
67+
className={cx(
68+
className,
69+
transition200,
70+
isVisible ? opacity100 : opacity0,
71+
styles.scrollWrapper,
72+
)}
73+
aria-hidden={!show}
6974
>
7075
<button
7176
onClick={onClick}
72-
tabIndex={isVisible ? 0 : -1}
77+
tabIndex={show ? 0 : -1}
7378
className={cx(
7479
'ghd-scroll-to-top', // for data tracking, see events.ts
7580
'tooltipped tooltipped-n tooltipped-no-delay btn circle border-1',

0 commit comments

Comments
 (0)