Closed bigopon closed 4 years ago
Probably only need key binding @combo('enter')
to call controller.ok()
.
I was not aware about the focus issue in aurelia-dialog because I mainly use Safari (buttons are not in focused by "tab" key in Safari). https://css-tricks.com/a-css-approach-to-trap-focus-inside-of-an-element/
In Chrome, aurelia-dialog does not prevent user from using "tab" key to shift focus to buttons out of dialog.
aurelia-dialog has a renderer to support native <dialog>
, but it is not supported on all the browsers, we probably need some implementation to trap focus in the dialog. This is kind of generic issue.
The commit only moves focus inside, not a proper solution to trap focus.
@3cp awesome. Thanks. For trapping focus, It's not that needed for now, or this dialog in particular, since you rarely open it
The default focus is on "fork" button. Hit "esc" to cancel (default aurelia-dialog behaviour).
Proper focus trap implemented in https://github.com/3cp/aurelia-dialog-lite No doc yet. It removed many options, all the custom elements, and attach-focus attribute.
At the moment, clicking on
fork
doesn't move the focus to inside the modal, I think it's better the focus is moved there. Maybe by default focus on the cancel button