Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-a11y: Remove story-root reference #16232

Closed
shilman opened this issue Oct 4, 2021 · 4 comments
Closed

Addon-a11y: Remove story-root reference #16232

shilman opened this issue Oct 4, 2021 · 4 comments

Comments

@shilman
Copy link
Member

shilman commented Oct 4, 2021

Originally posted by @kaelig in #16129 (comment)

By the way, what's this code supposed to do?

const storyRoot = document.getElementById('story-root');

Is #story-root a thing?

If this is only related to this addon, should it be documented?

@jam-awake
Copy link

jam-awake commented Nov 15, 2021

I believe this was supposed to look up the element parameter value, if it is provided. I just specified the element parameter on Storybook 6.3.12 and I get "The scan encountered an error: {}" in the panel. When I dropped the element parameter, the addon works fine. So, I explored the source code to see the control flow:

  1. axe is run on the element identifier
  2. the element identifier refers to the element specified in input or the return of getElement if it isn't provided
  3. getElement refers to an HTML element, either #root, the top-level div that contains a story by default when no decorators are used, or #story-root, a mysterious value.
  4. input is the value returned by getParams
  5. getParams either returns the element parameter if specified or null.

So, your real problem is that the element parameter's docs are incorrect. That parameter currently seems to do nothing.

@jsomsanith
Copy link
Contributor

Hi 👋
Fixed proposed here: #17989
Thanks @jam-awake for the investigation

@jsomsanith
Copy link
Contributor

PR merged

@shilman
Copy link
Member Author

shilman commented May 4, 2022

w00t!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-beta.4 containing PR #17989 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants