You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
For testing purposes I tried to create a sidenav, which should be triggered by the toolbar
But as you can see in the bad quality GIF, the css class is-focused will be added after dismissing the sidebar. So I already checked the code and I found this snippet
return $q(function(resolve){
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = isOpen;
$mdUtil.nextTick(function() {
// When the current `updateIsOpen()` animation finishes
promise.then(function(result) {
if ( !scope.isOpen ) {
// reset focus to originating element (if available) upon close
triggeringElement && triggeringElement.focus();
triggeringElement = null;
}
resolve(result);
});
});
});
I already fixed that in my version, but I want to ask the development team first about their thoughts.
So I created a merge for that, please take a look at it and tell me more about potential side-affects
Rather than providing a way to break accessibility, a proper solution for this would involve something like #5189: only show the focus style on keyboard interaction. Mouse users wouldn't see it. We definitely should not provide hooks to disable accessibility features, but rather apply those features in more specific ways.
That isn't a good solution for detecting the interaction type, because then I need to bind a listener on the triggeringElement. The Problem with binding the listener to the element is: I only get the current triggeringElement after the event is already triggered, so this would be useless.
Should I instead check for the global input methods? (like: touch or mouse)
Did you look at the library? It is checking global input methods. Consumers of the library don't have to do anything except include it and write some CSS. That said, I didn't think we would necessarily use a third-party lib in Angular Material, but I wanted to float it up as an example.
Activity
fix(sidenav): Keep focus clear after closing and opening sidenav.
feat(sidenav): added flag for triggered element to prevent focus rest…
devversion commentedon Nov 4, 2015
I referenced my both commits :) please take a look :)
With Fix 2, you simply need to add the flag
nofocusto themd-buttonThis happens too, on the docs
jelbourn commentedon Nov 5, 2015
cc @marcysutton
I believe that focus is there on purpose for accessibility reasons (indicates to keyboard users where the focus is).
devversion commentedon Nov 5, 2015
That's why I thought about creating an extra attribute which prevents focus recovery.
What do you think about that?
If you found a good solution, you can tell me :)
marcysutton commentedon Nov 5, 2015
Rather than providing a way to break accessibility, a proper solution for this would involve something like #5189: only show the focus style on keyboard interaction. Mouse users wouldn't see it. We definitely should not provide hooks to disable accessibility features, but rather apply those features in more specific ways.
devversion commentedon Nov 5, 2015
https://github.com/ten1seven/what-input
That isn't a good solution for detecting the interaction type, because then I need to bind a listener on the
triggeringElement. The Problem with binding the listener to the element is: I only get the currenttriggeringElementafter the event is already triggered, so this would be useless.Should I instead check for the global input methods? (like:
touchormouse)marcysutton commentedon Nov 5, 2015
Did you look at the library? It is checking global input methods. Consumers of the library don't have to do anything except include it and write some CSS. That said, I didn't think we would necessarily use a third-party lib in Angular Material, but I wanted to float it up as an example.
devversion commentedon Nov 5, 2015
Yeah, I took a look at it ;), so we should provide an own version of that with less features?
marcysutton commentedon Nov 5, 2015
That's the idea, yes. We don't need the full event API, just input detection allowing us to apply focus styles on keyboard interaction only.
fix(sidenav): Only restore focus if user interaction was keyboard
devversion commentedon Nov 5, 2015
I created a PR, I already tested it on my local environment. Now it only restores the focus if I trigger the sidenav with keyboard.
If there are any suggestions please tell me
47 remaining items
feat(interaction): added service to detect last interaction
cmacdonnacha commentedon May 30, 2016
Hey,
Just wondering what the status on this? I'm currently seeing the same behavior where focus is still set to the button after closing the sidenav.
Thanks!
devversion commentedon May 30, 2016
@cmacdonnacha Yeah, it's unfortunately still pending.
cmacdonnacha commentedon May 31, 2016
@devversion Thanks for the update.
ThomasBurleson commentedon Aug 24, 2016
@devversion - what is the PR associated with this issue ?
devversion commentedon Aug 24, 2016
@ThomasBurleson - #7965
feat(interaction): added service to detect last interaction
feat(interaction): added service to detect last interaction
feat(interaction): added service to detect last interaction (#7965)