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

[Docs] Use htmlIdGenerator()() in EuiFlyout examples for aria-labelledby #4774

Closed
cchaos opened this issue Apr 30, 2021 · 4 comments
Closed
Assignees
Labels
documentation Issues or PRs that only affect documentation - will not need changelog entries good first issue

Comments

@cchaos
Copy link
Contributor

cchaos commented Apr 30, 2021

It's a bit of a chore, but might it be worth it:

I've found that folks will sometimes copy our static ids from docs into their apps and then will run into multiple duplicate id issues.

This one is unlikely to cause that issue... But thought I'd bring it up anyways just for consistently having the same example of always using unique ids.

Originally posted by @myasonik in #4713 (comment)

@cchaos
Copy link
Contributor Author

cchaos commented Apr 30, 2021

Example:

if (isFlyoutVisible) {
flyout = (
<EuiFlyout
ownFocus
onClose={() => setIsFlyoutVisible(false)}
aria-labelledby="flyoutTitle">
<EuiFlyoutHeader hasBorder>
<EuiTitle size="m">
<h2 id="flyoutTitle">A typical flyout</h2>
</EuiTitle>

Would change to:

  const titleId = htmlIdGenerator('flyoutTitle')();

  if (isFlyoutVisible) {
    flyout = (
      <EuiFlyout
        ownFocus
        onClose={() => setIsFlyoutVisible(false)}
        aria-labelledby={titleId}>
        <EuiFlyoutHeader hasBorder>
          <EuiTitle size="m">
            <h2 id={titleId}>A typical flyout</h2>
          </EuiTitle>

@cchaos cchaos added assign:anyone documentation Issues or PRs that only affect documentation - will not need changelog entries good first issue labels Apr 30, 2021
@hetanthakkar
Copy link
Contributor

@cchaos Apart from this particular example, any other example you would like to change!? If I am not wrong this is a minor change

@myasonik
Copy link
Contributor

Anywhere in our docs that we set an id to a static string we probably want it to be a random string... Don't have a list of those cases though, you'd have to dig through the docs to see.

@hetanthakkar
Copy link
Contributor

@myasonik Thanks I am working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues or PRs that only affect documentation - will not need changelog entries good first issue
Projects
None yet
Development

No branches or pull requests

4 participants