Skip to content

Commit 9649fb5

Browse files
fix: add titles to buttons for better accessibility
1 parent a5eedb6 commit 9649fb5

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/ReportButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ export default function ReportButton(){
1010
const { paperId, subject, exam, slot, year } = usePaper();
1111
const [open, setOpen] = useState(false);
1212
return (
13-
<>
13+
<>
1414
<Button
15+
1516
onClick={() => setOpen(true)}
1617
className="h-10 w-10 rounded p-0 text-white transition hover:bg-red-600 bg-red-500"
18+
title="Report this paper"
1719
>
1820
<FaFlag className="text-sm" />
1921
</Button>

src/components/ShareButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function ShareButton() {
3030
return (
3131
<Dialog>
3232
<DialogTrigger asChild>
33-
<Button className="aspect-square h-10 w-10 p-0 rounded text-white bg-[#6536c1] transition hover:bg-[#7d4fc7]">
33+
<Button className="aspect-square h-10 w-10 p-0 rounded text-white bg-[#6536c1] transition hover:bg-[#7d4fc7]" title="Share this paper">
3434
<FaShare />
3535
</Button>
3636
</DialogTrigger>
@@ -47,6 +47,7 @@ export default function ShareButton() {
4747
type="submit"
4848
size="sm"
4949
className="flex w-fit items-center justify-between gap-5 px-3"
50+
title="Copy link to clipboard"
5051
onClick={async () => {
5152
await toast.promise(
5253
navigator.clipboard.writeText(paperPath), // This is a promise

src/components/newPdfViewer.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscr
114114
<Button
115115
onClick={toggleFullscreen}
116116
className="h-10 w-10 rounded p-0 text-white bg-[#6536c1] transition hover:bg-[#7d4fc7]"
117+
title={isFullscreen ? "Exit fullscreen" : "Enter fullscreen"}
117118
>
118119
{isFullscreen ? <Minimize2 size={24} /> : <Maximize2 size={24} />}
119120
</Button>
120121

121122
<Button
122123
onClick={onDownload}
123124
className="h-10 w-10 rounded p-0 text-white bg-[#6536c1] transition hover:bg-[#7d4fc7]"
125+
title="Download PDF"
124126
>
125127
<Download size={24} />
126128
</Button>
@@ -131,6 +133,7 @@ const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscr
131133
onClick={zoomOut}
132134
disabled={typeof zoomLevel === "number" && zoomLevel <= 0.25}
133135
className="h-10 w-10 rounded p-0 text-white bg-[#6536c1] transition hover:bg-[#7d4fc7] disabled:bg-gray-400"
136+
title="Zoom out"
134137
>
135138
<ZoomOut size={24} />
136139
</Button>
@@ -143,6 +146,7 @@ const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscr
143146
onClick={zoomIn}
144147
disabled={typeof zoomLevel === "number" && zoomLevel >= 3}
145148
className="h-10 w-10 rounded p-0 text-white bg-[#6536c1] transition hover:bg-[#7d4fc7] disabled:bg-gray-400"
149+
title="Zoom in"
146150
>
147151
<ZoomIn size={24} />
148152
</Button>

0 commit comments

Comments
 (0)