Files
supabase/apps/www/components/LaunchWeek/X/Album/Player.tsx
Danny White 6f6badae51 fix(eslint): promote require-explicit-tabindex to error (#48170)
## What kind of change does this PR introduce?

Accessibility / lint hardening (Safari keyboard focus).

## What is the current behavior?

`supabase/require-explicit-tabindex` is `'warn'`. Studio’s ratchet was
at 0 but the rule was still ratcheted; www / docs / design-system still
had raw `<button>` / `role="button"` call sites without an explicit
`tabIndex`.

[DEPR-627](https://linear.app/supabase/issue/DEPR-627) · follow-up to
#47984 / #48040

## What is the new behavior?

- Shared config: `'supabase/require-explicit-tabindex': 'error'`
- Swept www / docs / design-system (+ Studio test fixtures the ratchet
skipped)
- Removed the rule from the Studio ratchet + baselines

## To test

Prefer **Safari**. This PR only adds explicit `tabIndex` to raw
`<button>` / `role="button"` call sites — not links, and not controls
that already go through `Button` from `ui`.

### Marketing (`www`) ([staging
link](https://zone-www-dot-com-git-danny-depr-627-promote-req-7ae43c-supabase.vercel.app/))

- [x] Homepage frameworks / dashboard feature tabs — Tab through each
tab button
- [x] Product pages (e.g. `/auth`, `/database`) — section tab switchers
- [x] Narrow viewport — open the hamburger; Tab through menu buttons
- [x] `/partners/catalog` — filter / view controls
- [x] Blog view toggle (list ↔ grid)

### Docs ([staging
link](https://docs-git-danny-depr-627-promote-require-explici-25e46d-supabase.vercel.app/))

- [x] **Desktop (≥ lg):** top-right **⋯ menu** (hamburger icon) — opens
a dropdown that includes Theme. Not a separate theme button.
- [x] **Mobile (< lg):** top-right **hamburger** opens the sheet; close
(X) is the raw button we tagged. Theme inside the sheet uses
`ThemeToggle` / `DropdownMenuTrigger` from `ui` (already supposed to set
`tabIndex`).
- [x] **Code blocks** — copy / language controls
- [x] **Is this helpful?** — X / check are `Button` from `ui` (should
already Tab). After voting **while signed in**, the follow-up “What went
well?” / “How can we improve?” text button is the raw one we tagged.
- [x] **AI Tools → Copy as Markdown** (right rail on a guide) — this is
the only GuidesSidebar control this PR changed. “On this page” TOC items
are **links**, not covered by this lint.
- [x] **Reference docs** (e.g. JS client reference) — section headers
that expand/collapse in the left nav (`Collapsible.Trigger`)
- [x] **Troubleshooting index** — type in the search field, then Tab to
the **clear (X)** control

### Dashboard (`studio`)

No production UI changes in this PR (tests + lint config only). Quick
Safari smoke that prior tabindex work still holds:

- [x] Project sidebar — Tab through primary nav links
- [x] Settings → General — Tab through inputs / buttons
- [x] Storage → Files — Tab a bucket row / file actions
2026-07-23 05:21:15 +10:00

96 lines
3.4 KiB
TypeScript

import { ArrowRight } from 'lucide-react'
import Link from 'next/link'
import { useAudio } from 'react-use'
import { cn } from 'ui'
const Player = () => {
const [audio, state, controls, ref] = useAudio({
src: 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/audio/supabase-album/Bernard.m4a',
loop: true,
})
const isPlaying = state.playing
const trackName = audio.props.src?.split('/')?.slice(-1)?.toString()?.split('.')[0]
const duration = ref?.current?.duration ?? 0
const progress = (state.time * 100) / duration
const playerLength = 47
const playerProgress = -(progress * playerLength) / 100 - playerLength
return (
<div className="flex items-center gap-2">
{audio}
<Link
href="https://supabase.productions/"
target="_blank"
className={cn(
'opacity-0 outline-hidden group translate-x-2 ease-[cubic-bezier(.24,0,.22,.99)]! duration-200 transition-all text-foreground-muted hover:text-foreground leading-3! font-mono uppercase text-[10px] flex flex-col text-right',
isPlaying && 'opacity-100 translate-x-0'
)}
>
<span className="text-border-strong">Now playing</span>
<span className="tracking-widest flex justify-end gap-px text-right translate-x-0 transition-transform group-hover:-translate-x-2">
{trackName}
<ArrowRight className="w-3 h-3 opacity-0 group-hover:opacity-100 -mr-full absolute -right-3 text-current transition-opacity" />
</span>
</Link>
<button
tabIndex={0}
onClick={isPlaying ? controls.pause : controls.play}
className="relative outline-border-muted w-7 h-7 opacity-70 hover:opacity-100 rounded-full flex items-center justify-center text-foreground-muted hover:text-foreground-lighter transition-opacity"
style={{
background: `radial-gradient(closest-side, #060809 79%, transparent 95% 100%),conic-gradient(var(--foreground-lighter) ${progress.toFixed()}%, var(--border-muted) 0)`,
}}
>
<svg
className="absolute inset-0 w-full h-full -rotate-90"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle opacity="0.1" cx="8" cy="8" r="7.5" stroke="var(--foreground-default)" />
<circle
cx="8"
cy="8"
r="7.5"
stroke="white"
opacity="0.4"
strokeLinecap="round"
className={cn('transition-opacity', isPlaying ? 'opacity-30' : 'opacity-10')}
strokeDasharray={playerLength}
strokeDashoffset={playerProgress}
/>
</svg>
{isPlaying ? (
<svg
className="w-2.5 h-2.5"
width="12"
height="12"
viewBox="0 0 12 12"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect x="1" width="4" height="12" fill="currentColor" />
<rect x="7" width="4" height="12" fill="currentColor" />
</svg>
) : (
<svg
className="w-2.5 h-2.5 transform translate-x-px"
width="11"
height="12"
viewBox="0 0 11 12"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M11.0075 6L0.20752 0V12" fill="currentColor" />
</svg>
)}
</button>
</div>
)
}
export default Player