This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović
…if you're putting cursor: pointer
on a <th>
with a click event attached, you want to use a <button>
instead.
<th style="cursor: pointer">
Name
</th>
More accessible alternative:
<th aria-sort="ascending">
<button>Name</button>
</th>
Explanation
Only put click events on interactive elements like <button>
. <th>
is not an interactive element and thus not focusable.
My blog doesn't support comments yet, but you can reply via blog@matuzo.at.
This content originally appeared on Manuel Matuzović - Web development blog and was authored by Manuel Matuzović

Manuel Matuzović | Sciencx (2023-04-21T09:46:54+00:00) button when cursor:pointer. Retrieved from https://www.scien.cx/2023/04/21/button-when-cursorpointer/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.