Storybook: a11y addon - addParameters doesn't work (react)

Created on 7 Mar 2019  路  5Comments  路  Source: storybookjs/storybook

I've tried to limit inspect elements only to selector scope.

In config.js file I added:

addDecorator(withA11Y);

addParameters({
    a11y: {
      element: '#foo'
    }
  });

Expected behavior
It should be limited to provided selector.

Screenshots
zrzut ekranu 2019-03-7 o 13 34 48

Code snippets
If applicable, add code samples to help explain your problem.

System:

  • OS: MacOS
  • Device: Mac mini
  • Browser: chrome
  • Framework: react
  • Addons: a11y
  • Version: 5.0.0

I've also noticed that addon should work with import { withA11y } from '@storybook/addon-a11y' and addDecorator(withA11y). However, it seems to be working without a decorator. What's more I also tried to do something like this: import { } from '@storybook/addon-a11y' and it also worked.
Maybe there is something wrong with index.js file.

Could someone explain me, please, what's wrong?

a11y bug good first issue

Most helpful comment

I take this issue.

All 5 comments

@customcodepl I just took a look at the code and it looks like the addon lost support for the element parameter in the v4 => v5 upgrade:

https://github.com/storybooks/storybook/blob/next/addons/a11y/src/index.js#L14

Should be easy to add back -- any interest in taking a shot at that?

I take this issue.

Ready!

You rock @Armanio !!!

Ermahgerd!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.4 containing PR #5996 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

Was this page helpful?
0 / 5 - 0 ratings