Describe the bug
When using the a11y storybook addon, scenarios which should return violations but are not doing so.
To Reproduce
Steps to reproduce the behavior:
npm install -D @storybook/addon-a11yimport '@storybook/addon-a11y/register';import { checkA11y, configureA11y } from '@storybook/addon-a11y';display: noneExpected behavior
Should see violations as component is not meeting the a11y configurations ['wcag2a', 'wcag2aa', 'wcag21aa']
Screenshots
Storybook official netlify link

My own project

Code snippets
button.stories.ts
import { storiesOf } from '@storybook/angular';
import { withNotes } from '@storybook/addon-notes';
import { action } from '@storybook/addon-actions';
import { checkA11y, configureA11y } from '@storybook/addon-a11y';
import { ButtonComponent } from '../projects/component-library/src/lib/buttons/button/button.component';
// a11y Configurations
const a11yConfigs = {
runOnly: ['wcag2a', 'wcag2aa', 'wcag21aa'],
};
configureA11y(a11yConfigs);
storiesOf('Buttons/Button', module)
.addDecorator(checkA11y)
.addDecorator(withNotes)
.add(
'Primary',
() => ({
component: ButtonComponent,
props: {
btnClick: action('Button was clicked'),
text: 'Prescribe',
},
}),
{ notes: 'Primary style button' }
)
.add(
'Primary disabled',
() => ({
component: ButtonComponent,
props: {
text: 'Prescribe',
disabled: true,
},
}),
{ notes: 'Primary style disabled button' }
);
button.component.scss
$primary-color: #0033a0;
$primary-hover: #00277c;
$primary-disabled: #cac8c5;
button {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
height: 44px;
letter-spacing: 0.01em;
font-size: 14px;
border-radius: 100px;
min-width: 196px;
padding: 0 16px;
font-family: Helvetica;
color: #fff;
&:focus {
outline: none;
}
&.primary {
background-color: #fff;
&:hover {
background-color: #fff;
}
&:active {
background-color: #fff;
}
&:disabled {
cursor: default;
background-color: $primary-disabled;
}
}
}
System:
Additional context
n/a
Storybook is not displaying any violations because in this case (BaseButton | Invalid contrast) axe-core, the library we are using for a11y, doesn't return any violations.
In fact this color-contrast rule is not in "passing" rules array neither but in incomplete.

As per doc:
The incomplete array (also referred to as the "review items") indicates which nodes could neither be determined to definitively pass or definitively fail. They are separated out in order that a user interface can display these to the user for manual review (hence the term "review items").
BUT for now only passes and violations array are displayed in SB ui. Maybe we should think about adding something to display incomplete rules array?
Thanks @gaetanmaisse . Opened a new feature request for this and closing this issue for now.
Most helpful comment
Thanks @gaetanmaisse . Opened a new feature request for this and closing this issue for now.