Focus trap for QDialog #16756
-
Hi, I am working on an accessibility issue related to QDailog and realized that there is no custom prop from the plugin itself to trap focus. It would be nice if Quasar provided a prop for the dialog, for example, Another idea might be to just trap the focus as I described above as a default behavior for the dialog. Do you have any plans to do something like this? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi @NikolaNbgd |
Beta Was this translation helpful? Give feedback.
-
Hi, The focus is already trapped inside of the Dialog, but we cannot override the browser behavior of being able to focus on the address bar too. Moreover, if the Developer Tools is also opened, we also cannot avoid focusing on it too. The current default behavior IS to trap the focus within the Dialog's elements given the above exceptions (addressbar or Dev tools).
|
Beta Was this translation helpful? Give feedback.
-
Thank you both. I found the solution by using this library: https://pdanpdan.github.io/vue-keyboard-trap/. It provides a global directive that traps focus only within the dialog itself. |
Beta Was this translation helpful? Give feedback.
Hi,
The focus is already trapped inside of the Dialog, but we cannot override the browser behavior of being able to focus on the address bar too. Moreover, if the Developer Tools is also opened, we also cannot avoid focusing on it too.
The current default behavior IS to trap the focus within the Dialog's elements given the above exceptions (addressbar or Dev tools).
There are also the following props, should you want to configure how the focus works (disabling more of the default features):