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

data-modal-background-click="disabled" extended #8

Open
goetsu opened this issue Apr 15, 2018 · 4 comments
Open

data-modal-background-click="disabled" extended #8

goetsu opened this issue Apr 15, 2018 · 4 comments
Assignees

Comments

@goetsu
Copy link

goetsu commented Apr 15, 2018

this feature may be use in case of alertdialog instead of dialog so if it's not currently the case this must also prevent to close the dialog using esc key.

Otherwise maybe you can do extra data attributes like :

  • data-modal-esc-key="disabled"
  • data-modal-role="alertdialog" -> will automatically, change role to alertdialog instead of dialog, disable click on background and esc key to close, remove close button and move focus on the dialog itself instead of on the close button
@nico3333fr nico3333fr self-assigned this Apr 16, 2018
@nico3333fr
Copy link
Owner

So @goetsu => basically, the alertdialog option has to:

  • remove the background click option (ok)
  • avoid the Esc key (ok)
  • remove the close button (???)
  • should give focus to the dialog itself or to another element? (the h1?)

How a user can close it?

@goetsu
Copy link
Author

goetsu commented Apr 17, 2018

alertdialog are like

do you want do confirm suppresion of your account :
yes or no

or like
sorry an error occured please go back to your account

It's the user interaction within the modal that will close it so focus need to be moved in a specific element within the modal that can change depending on the content. Maybe you can do that by adding a data-modal-alertdialog-focustarget data attribute on the target element and move focus on it when the modal open (if used on a not focusable by default element the script will need to add a tabindex="-1" on it otherwise it will not work)

Also I forgot that in some case it's best to use aria-describedby on the modal itself see https://www.w3.org/TR/wai-aria-1.1/#alertdialog . Maybe you can do that by adding a data-modal-alertdialog-descriptiontarget data attribut on the target element that will generate a unique id attribute on this element and use this is id on the aria-describedby added to the modal

@nico3333fr
Copy link
Owner

nico3333fr commented Apr 20, 2018

It's the user interaction within the modal that will close it so focus need to be moved in a specific element within the modal that can change depending on the content. Maybe you can do that by adding a data-modal-alertdialog-focustarget data attribute on the target element and move focus on it when the modal open (if used on a not focusable by default element the script will need to add a tabindex="-1" on it otherwise it will not work)

So basically, let's sum up: to have a alertdialog:

  • remove the background click option (ok)
  • avoid the Esc key (ok)
  • remove the "standard" close button (in the doc, it will be added that you must propose a closing option, the script already proposes one by adding a class js-modal-close on an element in the modal)
  • provide focus on an element in the modal

In fact, we already have the option to give focus to an element (See 4th example: https://van11y.net/downloads/modal/demo/index.html). I suggest to provide focus on the title h1 in the alert modal (so should be with tabindex="-1".

Is it ok for you?

Also I forgot that in some case it's best to use aria-describedby on the modal itself see https://www.w3.org/TR/wai-aria-1.1/#alertdialog . Maybe you can do that by adding a data-modal-alertdialog-descriptiontarget data attribut on the target element that will generate a unique id attribute on this element and use this is id on the aria-describedby added to the modal

Let's separe this case, otherwise it will be too complicated.

@Oliv-
Copy link
Contributor

Oliv- commented Mar 2, 2020

Une modal sans bouton de fermeture pour les cas où c'est nécessaire, +1 !

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