Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/frame/components/ui/ScrollButton/ScrollButton.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

.opacity0 {
opacity: 0;
pointer-events: none;
}

.opacity100 {
opacity: 1;
pointer-events: auto;
}

.customFocus:focus:not(:focus-visible), // override primer css specificity
Expand All @@ -21,3 +23,10 @@
width: 2.5rem;
height: 2.5rem;
}

// When the viewport is too short to show the button permanently,
// reveal it on keyboard focus so it remains accessible (a11y #16466).
.scrollWrapper:has(.scrollButton:focus-visible) {
opacity: 1;
pointer-events: auto;
}
11 changes: 8 additions & 3 deletions src/frame/components/ui/ScrollButton/ScrollButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
return (
<div
role="tooltip"
className={cx(className, transition200, isVisible ? opacity100 : opacity0)}
aria-hidden={!isVisible}
className={cx(
className,
transition200,
isVisible ? opacity100 : opacity0,
styles.scrollWrapper,
)}
aria-hidden={!show}
>
<button
onClick={onClick}
tabIndex={isVisible ? 0 : -1}
tabIndex={show ? 0 : -1}
className={cx(
'ghd-scroll-to-top', // for data tracking, see events.ts
'tooltipped tooltipped-n tooltipped-no-delay btn circle border-1',
Expand Down