From 32090c64bdf79c0717eaa24d267add0bb4b31e74 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Wed, 29 Dec 2021 10:37:58 +0100 Subject: [PATCH] fix: prevent unwarranted a11y warnings on custom Button subclasses (#3238) * fix: prevent unwarranted a11y warnings on UploadImageButton * chore: format * refactor * fix: remove attr --- framework/core/js/src/common/components/Button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/js/src/common/components/Button.tsx b/framework/core/js/src/common/components/Button.tsx index 991a0b890..86e9ce001 100644 --- a/framework/core/js/src/common/components/Button.tsx +++ b/framework/core/js/src/common/components/Button.tsx @@ -107,7 +107,7 @@ export default class Button 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