Skip to content

Commit

Permalink
feat(core): remove error logging for missing aria attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnfeldpausch committed Jun 19, 2024
1 parent 9de1247 commit a0bdf28
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 101 deletions.
5 changes: 0 additions & 5 deletions core/src/components/cat-avatar/cat-avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, h, Prop, State, Watch } from '@stencil/core';
import { delayedAssertWarn } from '../../utils/assert';
import loadImg from '../../utils/load-img';

/**
Expand Down Expand Up @@ -69,10 +68,6 @@ export class CatAvatar {
this.onSrcChanged(this.src);
}

componentWillRender(): void {
delayedAssertWarn(this, () => !!this.label, '[A11y] Missing ARIA label on avatar');
}

render() {
if (this.url) {
return (
Expand Down
5 changes: 0 additions & 5 deletions core/src/components/cat-button/cat-button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';
import { delayedAssertWarn } from '../../utils/assert';
import { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';
import { MediaMatcher } from '../../utils/media-matcher';

Expand Down Expand Up @@ -184,10 +183,6 @@ export class CatButton {
this.onIconOnlyChanged(this.iconOnly);
}

componentWillRender(): void {
delayedAssertWarn(this, () => !this.isIconButton || !!this.a11yLabel, '[A11y] Missing ARIA label on icon button');
}

@Listen('click')
haltDisabledEvents(event: Event): void {
if (this.disabled || this.loading) {
Expand Down
13 changes: 0 additions & 13 deletions core/src/components/cat-checkbox/cat-checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';
import { delayedAssertWarn } from '../../utils/assert';
import { CatFormHint } from '../cat-form-hint/cat-form-hint';

let nextUniqueId = 0;
Expand Down Expand Up @@ -124,18 +123,6 @@ export class CatCheckbox {
this.updateResolved();
}

componentWillRender(): void {
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on checkbox'
);
}

/**
* Programmatically move focus to the checkbox. Use this method instead of
* `input.focus()`.
Expand Down
13 changes: 0 additions & 13 deletions core/src/components/cat-date-inline/cat-date-inline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, St
import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';
import { getLocale } from './cat-date-locale';
import { addDays, addMonth, clampDate, isSameDay, isSameMonth, isSameYear } from './cat-date-math';
import { delayedAssertWarn } from '../../utils/assert';
import firstTabbable from '../../utils/first-tabbable';

let nextUniqueId = 0;
Expand Down Expand Up @@ -127,18 +126,6 @@ export class CatDateInline {
}
}

componentWillRender(): void {
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on input'
);
}

componentDidRender() {
if (this.focusDate) {
// re-focus the previously focused date after re-render
Expand Down
10 changes: 0 additions & 10 deletions core/src/components/cat-input/cat-input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';
import Cleave from 'cleave.js';
import type { CleaveOptions } from 'cleave.js/options';
import { delayedAssertWarn } from '../../utils/assert';
import { coerceBoolean, coerceNumber } from '../../utils/coerce';
import { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';
import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';
Expand Down Expand Up @@ -209,15 +208,6 @@ export class CatInput {

componentWillRender(): void {
this.onErrorsChanged(this.errors);
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on input'
);
}

/**
Expand Down
13 changes: 0 additions & 13 deletions core/src/components/cat-radio/cat-radio.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';
import { delayedAssertWarn } from '../../utils/assert';
import { CatFormHint } from '../cat-form-hint/cat-form-hint';

let nextUniqueId = 0;
Expand Down Expand Up @@ -103,18 +102,6 @@ export class CatRadio {
*/
@Event() catBlur!: EventEmitter<FocusEvent>;

componentWillRender(): void {
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on radio'
);
}

/**
* Programmatically move focus to the radio button. Use this method instead of
* `input.focus()`.
Expand Down
10 changes: 0 additions & 10 deletions core/src/components/cat-select/cat-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
tap,
timer
} from 'rxjs';
import { delayedAssertWarn } from '../../utils/assert';
import { coerceBoolean, coerceNumber } from '../../utils/coerce';
import { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';
import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';
Expand Down Expand Up @@ -360,15 +359,6 @@ export class CatSelect {

componentWillRender(): void {
this.onErrorsChanged(this.errors);
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on select'
);
}

@Listen('blur')
Expand Down
10 changes: 0 additions & 10 deletions core/src/components/cat-textarea/cat-textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';
import autosize from 'autosize';
import { delayedAssertWarn } from '../../utils/assert';
import { coerceBoolean, coerceNumber } from '../../utils/coerce';
import { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';
import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';
Expand Down Expand Up @@ -153,15 +152,6 @@ export class CatTextarea {

componentWillRender(): void {
this.onErrorsChanged(this.errors);
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on textarea'
);
}

componentDidLoad(): void {
Expand Down
13 changes: 0 additions & 13 deletions core/src/components/cat-toggle/cat-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';
import { delayedAssertWarn } from '../../utils/assert';
import { CatFormHint } from '../cat-form-hint/cat-form-hint';

let nextUniqueId = 0;
Expand Down Expand Up @@ -120,18 +119,6 @@ export class CatToggle {
this.updateResolved();
}

componentWillRender(): void {
delayedAssertWarn(
this,
() => {
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
this.hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
return !!this.label && !!this.hasSlottedLabel;
},
'[A11y] Missing ARIA label on toggle'
);
}

/**
* Programmatically move focus to the toggle. Use this method instead of
* `input.focus()`.
Expand Down
9 changes: 0 additions & 9 deletions core/src/utils/assert.ts

This file was deleted.

0 comments on commit a0bdf28

Please sign in to comment.