Skip to content

Commit

Permalink
fix: prevent unwarranted a11y warnings on custom Button subclasses (#…
Browse files Browse the repository at this point in the history
…3238)

* fix: prevent unwarranted a11y warnings on UploadImageButton

* chore: format

* refactor

* fix: remove attr
  • Loading branch information
davwheat authored Dec 29, 2021
1 parent 8fac735 commit 2541cde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/src/common/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> ext

const { 'aria-label': ariaLabel } = this.attrs;

if (!ariaLabel && !extractText(vnode.children) && !this.element?.getAttribute?.('aria-label')) {
if (this.view === Button.prototype.view && !ariaLabel && !extractText(vnode.children) && !this.element?.getAttribute?.('aria-label')) {
fireDebugWarning(
'[Flarum Accessibility Warning] Button has no content and no accessible label. This means that screen-readers will not be able to interpret its meaning and just read "Button". Consider providing accessible text via the `aria-label` attribute. https://web.dev/button-name',
this.element
Expand Down

0 comments on commit 2541cde

Please sign in to comment.