Skip to content

Commit a0a24b6

Browse files
authored
Keyboard Focus for Guides Page: Learning Paths (github#24483)
* remove useEffect on ref * updating keyboard focus for guides page
1 parent 707194d commit a0a24b6

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

components/guides/LearningTrack.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
background: linear-gradient(to top, var(--color-canvas-default), transparent);
33
}
44

5+
.removeHoverEvents {
6+
pointer-events: none;
7+
}
8+
59
/* Because of the sticky header */
610
.hashAnchor {
711
&:target {

components/guides/LearningTrack.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,29 @@ export const LearningTrack = ({ track }: Props) => {
108108
></ActionList>
109109
</div>
110110
)}
111-
{(track?.guides?.length || 0) > numVisible ? (
111+
{
112112
<button
113-
className="Box-footer btn-link border-top-0 position-relative text-center text-bold color-fg-accent pt-1 pb-3 col-12"
113+
className={
114+
'Box-footer btn-link border-top-0 position-relative text-center text-bold color-fg-accent pt-1 pb-3 col-12 ' +
115+
((track?.guides?.length || 0) <= numVisible && cx(styles.removeHoverEvents))
116+
}
114117
onClick={showAll}
115118
>
116-
<div
117-
className={cx('position-absolute left-0 right-0 py-5', styles.fadeBottom)}
118-
style={{ bottom: '50px' }}
119-
></div>
120-
<span>
121-
Show {(track?.guides?.length || 0) - numVisible} {t(`more_guides`)}
122-
</span>
119+
{(track?.guides?.length || 0) > numVisible ? (
120+
<div>
121+
<div
122+
className={cx('position-absolute left-0 right-0 py-5', styles.fadeBottom)}
123+
style={{ bottom: '50px' }}
124+
/>
125+
<span>
126+
Show {(track?.guides?.length || 0) - numVisible} {t(`more_guides`)}
127+
</span>
128+
</div>
129+
) : (
130+
<span className="color-fg-default">All guides shown</span>
131+
)}
123132
</button>
124-
) : (
125-
<div />
126-
)}
133+
}
127134
</div>
128135
</div>
129136
)

0 commit comments

Comments
 (0)