News for hackers. Stuff that matters.
Re:Reddit's Recently Announced API Changes, and the future o... by extra88 on Sunday June 11, 2023 @11:46PM (#36288230)
No, your first code snippet is totally fine. The button's name comes from its descendent elements by default. In this case, the `alt` attribute of the image provides the name.

Sara is good source for accessibility information but I think you've misinterpreted that post. If an icon button uses an `img`, making the image's `alt` the name of the button works well. If the button's icon comes from an inline SVG, background image, or icon font, I recommend Sara's first technique, visually hidden text within the `button`; names from text nodes are more robust than from attributes (`alt` being an exception, in part because it has been around far longer).

Re:Reddit's Recently Announced API Changes, and the future o... by d1sxeyes on Thursday June 22, 2023 @06:01AM (#36429940)
Thank you for the correction! Always good to learn.