dialog: should disable accesskeys for elements not in the dialog
Actual Behavior:
What is the issue? *Currently, dialogs still allow HTML 4accesskeys to be used for elements behind the dialog.What is the expected behavior?Dialogs should only respond toaccesskeys inside the dialog. There is discussion on how jQueryUI does it at http://stackoverflow.com/a/22842358/725752.
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:http://codepen.io/anon/pen/QdOjOKDetails:The accesskeys for the buttons are underlined. Open a dialog then hit alt + key. It will close the current dialog and open another one.
Angular Versions: *
Angular Version:1.5.5Angular Material Version:1.1.1
Additional Information:
Browser Type: *tested on Chrome, I suspect all other are the same.Browser Version: *OS: *WindowsStack Traces:
Shortcut to create a new CodePen Demo.
Note: * indicates required information. Without this information, your issue may be auto-closed.
Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.
Agreed! I made a util that I call to accomplish this, but it would be great if it were built it. Here's what I'm doing if anyone needs it.
Off in a utils module somewhere:
// want to make sure we haven't forgotten to replace the keys from the last time.
let accesskeysRemoved = false;
utils.removeAllAccesskeys = () => {
// TODO: uses jQuery
if(accesskeysRemoved) {
throw new Error("It looks like you've already removed the accesskeys and have not restored them yet. Calling remove again before restoring will lead to unintended consequences.");
}
accesskeys = $('[accesskey]').each(function() {
$(this).data('ak', $(this).attr('accesskey')).removeAttr('accesskey');
});
accesskeysRemoved = true;
};
utils.restoreAllAccesskeys = () => {
// TODO: uses jQuery
accesskeys.each(function() {
$(this).attr('accesskey', $(this).data('ak'));
});
accesskeysRemoved = false;
};
Opening a dialog (injecting my 'utils' helper, of course):
$mdDialog.show({
...
onShowing: () => {
utils.removeAllAccesskeys();
},
onRemoving: () => {
utils.restoreAllAccesskeys();
}
})
MDN says that I should press Control + Alt + key on macOS with Chrome. However, that doesn't work for me. I also tried in Safari and Firefox on macOS, but none of the keys activated any of the buttons.
I updated the CodePen to 1.1.22 but that didn't help. I also tried using CodePen's "Debug" view so that it was just the app w/o any of the CodePen chrome, but that didn't help either.
For now, I'm going to say that this isn't a core feature (partly based on the views of WebAIM) that should be part of the library. I'm happy to reconsider given some feedback that enables me to reproduce this on macOS.