mirror of
https://github.com/flarum/framework.git
synced 2025-02-24 00:15:41 +08:00
fix: prevent unwarranted a11y warnings on custom Button subclasses (#3238)
* fix: prevent unwarranted a11y warnings on UploadImageButton * chore: format * refactor * fix: remove attr
This commit is contained in:
parent
3290eba64e
commit
32090c64bd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user