Buttons that miss a label are often an icon without text and label (e.g. a delete button with a trash icon).
https://developer.mozilla.org/en-US/docs/Web/Accessibility/A...
However a button that looks like this:
<button type="button">
<img src="/delete.png" alt="Delete post" />
</button>
Is not. Screen readers will read the simple text on the button, but any descendants of the button will be considered purely presentational (even if as in the example above the img tag includes an 'alt' attribute, it won't be read).Modern screen readers will now often parse text content out of the button even if there are descendants, but this behaviour is not reliable or according to spec.
To fix:
<button type="button" aria-label="Delete post">
<img src="/delete.png" alt="Delete post" />
</button>
There are other techniques as well such as using CSS to hide text (not with 'display: none' though, which also hides from screen readers, meaning this often feels a bit hacky) or using a hidden element with text content and aria-labelledby to reference the element's ID.This is a pretty good walk through: https://www.sarasoueidan.com/blog/accessible-icon-buttons/#a...
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).