button when cursor:pointer

…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>Nam…


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ć


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » button when cursor:pointer." Manuel Matuzović | Sciencx - Friday April 21, 2023, https://www.scien.cx/2023/04/21/button-when-cursorpointer/
HARVARD
Manuel Matuzović | Sciencx Friday April 21, 2023 » button when cursor:pointer., viewed ,<https://www.scien.cx/2023/04/21/button-when-cursorpointer/>
VANCOUVER
Manuel Matuzović | Sciencx - » button when cursor:pointer. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/21/button-when-cursorpointer/
CHICAGO
" » button when cursor:pointer." Manuel Matuzović | Sciencx - Accessed . https://www.scien.cx/2023/04/21/button-when-cursorpointer/
IEEE
" » button when cursor:pointer." Manuel Matuzović | Sciencx [Online]. Available: https://www.scien.cx/2023/04/21/button-when-cursorpointer/. [Accessed: ]
rf:citation
» button when cursor:pointer | Manuel Matuzović | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.