-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(interaction): added service to detect last interaction #5589
feat(interaction): added service to detect last interaction #5589
Conversation
I added a few more tests, more test will come as soon as possible |
@@ -227,7 +227,7 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate, | |||
*/ | |||
function postLink(scope, element, attr, sidenavCtrl) { | |||
var lastParentOverFlow; | |||
var triggeringElement = null; | |||
var triggeringElement = null, triggeringInteractionType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please separate to another declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed...the trickiness here hinders code readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't happen again, didn't know about this style policy ;)
Please fix and squash your commits to 1 commit |
642bd11
to
7f45663
Compare
Commits successfully squashed, thanks for reviewing @EladBezalel @marcysutton |
7f45663
to
5dd246d
Compare
Sidenav want's to restore focus after the pane gets closed, this should only happen for keyboard interactions. The service got created to use that feature for other components too Fixes angular#5563 Fixes angular#5434 Closes angular#5583 Closes angular#5589 feat(interaction): add test for interaction which fakes a keyboard input and validates it test(interaction): add interaction spec for mousedown event + formats 4 spaces to 2 style(interaction): fix styling of the previous commits
@@ -0,0 +1,26 @@ | |||
describe("$mdInteraction", function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to see some additional tests here. Since the focus style hinges off of .md-focused
being added, we could test that it gets added on keyboard interaction and not mouse.
febc90e
to
29d4146
Compare
Sidenav want's to restore focus after the pane gets closed, this should only happen for keyboard interactions. The service got created to use that feature for other components too Fixes angular#5563 Fixes angular#5434 Closes angular#5583 Closes angular#5589 feat(interaction): add test for interaction which fakes a keyboard input and validates it test(interaction): add interaction spec for mousedown event + formats 4 spaces to 2 style(interaction): fix styling of the previous commits test(sidenav): add sidenav focus restore test triggered by keyboard test(sidenav): add focus restore test for mouse and patch other one fix(sidenav): test
Added two tests into the |
var el; | ||
inject(function($compile, $rootScope) { | ||
var parent = angular.element(document.body); | ||
el = angular.element('<button aria-label="Toggle Menu">Toggle</button>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that the tests show correct requirements, you don't need aria-label
here since the button has text in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
63e270c
to
0cf58e4
Compare
Sidenav want's to restore focus after the pane gets closed, this should only happen for keyboard interactions. The service got created to use that feature for other components too Fixes angular#5563 Fixes angular#5434 Closes angular#5583 Closes angular#5589 feat(interaction): add test for interaction which fakes a keyboard input and validates it test(interaction): add interaction spec for mousedown event + formats 4 spaces to 2 style(interaction): fix styling of the previous commits test(sidenav): add sidenav focus restore test triggered by keyboard test(sidenav): add focus restore test for mouse and patch other one fix(sidenav): test fix(sidenav): replace deprecated methods, and remove aria label test(sidenav): revert deprecated methods.
@@ -344,9 +346,9 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate, | |||
// When the current `updateIsOpen()` animation finishes | |||
promise.then(function(result) { | |||
|
|||
if ( !scope.isOpen ) { | |||
if ( !scope.isOpen && triggeringElement && triggeringInteractionType && triggeringInteractionType === 'keyboard') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triggeringInteractionType && triggeringInteractionType === 'keyboard'
can be simplified to
triggeringInteractionType === 'keyboard'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good idea.
d741eab
to
620fa6f
Compare
620fa6f
to
28aa59a
Compare
28aa59a
to
e9faf66
Compare
Sidenav want's to restore focus after the pane gets closed, this should only happen for keyboard interactions.
The service got created to use that feature for other components too
Fixes #5563 Fixes #5434 Closes #5583