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

[EuiModal] Accessibilty and experience updates #3889

Closed
thompsongl opened this issue Aug 11, 2020 · 11 comments
Closed

[EuiModal] Accessibilty and experience updates #3889

thompsongl opened this issue Aug 11, 2020 · 11 comments

Comments

@thompsongl
Copy link
Contributor

Recent focus trap updates (#3631) raised the question of the default behavior of EuiModal as it relates to ownFocus and other features the new library affords (scroll locking and pointer-event disabling).

Let's discuss what (if any) changes to make, and what longstanding a11y issues we can resolve in the process.

@thompsongl
Copy link
Contributor Author

@myasonik Do you have a more curated list of a11y changes/improvements?

@myasonik
Copy link
Contributor

myasonik commented Aug 14, 2020

  • I think EuiModal already has ownFocus on by default and we brought up adding ownFocus on by default for other components (such as Flyovers and Popovers).

  • For basic markup, a dialog doesn't need too much:

     <section role="dialog" aria-modal="true">
     	<button aria-label="close modal">x</button>
     	{content}
     </section>
    
    • A dialog always needs a name (aria-label or aria-labelledby). If there's a title in the modal, aria-labelledby should point to it. aria-describedby is optional.
    • If there's a title, it should default to an h1
  • For functionality, we should have:

    • On esc, close the modal
    • the focus-lock stuff
    • On clicking outside the modal, close the modal (optional)
    • When the modal opens, focus needs to move into the modal. It can go on the wrapping container (in which case you add tabindex=-1 but it can also go to an internal form field if the modal is a form or ok/cancel for confirmation modal. (Always going to the wrapper is an ok default experience.) (It shouldn't default to the close button.)
    • When modal closes, focus on the button that opened the modal. If it no longer exists, user should provide where focus goes. (Ideally, this would be easily overwritable but heavily enforced because we're terrible at ensuring focus isn't lost.)
  • Probably just a docs addition, it's sometimes recommended to add a note to buttons that they open a modal if the button text isn't clear about it:

<button>
  Add a thing
  <EuiScreenReaderOnly>Opens a modal</EuiScreenReaderOnly>
</button>

@thompsongl
Copy link
Contributor Author

@cchaos I recall you mentioning wanting to add an overlay mask to EuiModal by default, also. Does that sound right?

@cchaos
Copy link
Contributor

cchaos commented Aug 14, 2020

Yeah I think it makes sense to have it similar to flyout, where ownFocus comes with the overlay mask.

@github-actions
Copy link

github-actions bot commented May 3, 2021

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@nansing90
Copy link

@thompsongl Please let us know what is the proposed solution for this bug?

@thompsongl
Copy link
Contributor Author

thompsongl commented Jun 28, 2022

Looks like the only remaining recommended updates to EuiModal are attribute and ARIA additions:

For basic markup, a dialog doesn't need too much:

<section role="dialog" aria-modal="true">
	<button aria-label="close modal">x</button>
	{content}
</section>

A dialog always needs a name (aria-label or aria-labelledby). If there's a title in the modal, aria-labelledby should point to it. aria-describedby is optional.
If there's a title, it should default to an h1

@thompsongl
Copy link
Contributor Author

We could consider adding outsideClickCloses boolean prop like EuiFlyout has, also.

@cchaos
Copy link
Contributor

cchaos commented Jun 28, 2022

We could consider adding outsideClickCloses boolean prop like EuiFlyout has, also.

We've specifically said no to this request every time it has come up based on our guidelines of usage (that every modal must have a distinct close button).

@1Copenut
Copy link
Contributor

@daveyholler Let's review this in next backlog groom. I think it might be able to close.

@daveyholler
Copy link
Contributor

Already complete

@daveyholler daveyholler closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2023
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

6 participants