Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datepicker): prevent focustrap to restore focus on destroy #2392

Closed
wants to merge 1 commit into from

Conversation

benouat
Copy link
Member

@benouat benouat commented May 22, 2018

With this fix, focustrap on datepicker will no longer remember element focused prior initialization, and thus won't try to set it back on destroy.

fixes #2372

@benouat benouat changed the title fix(datepicker): prevent focustrap to resotre focus on destroy fix(datepicker): prevent focustrap to restore focus on destroy May 22, 2018
@maxokorokov maxokorokov added this to the 2.0.1 milestone May 23, 2018
@@ -48,7 +48,7 @@ describe('ngbFocusTrap', () => {
});
});

it('should save/restore focused element when autofocus is set', () => {
it('should focus element decorated with ngbAutofocus when created', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this tests truly verifies what it claims? I can't see any element with ngbAutofocus anywhere....

Copy link
Member Author

@benouat benouat May 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, I see. But still, we should have an expectation verifying that this element is actually focused, no?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, it was just GitHub diff view not showing the whole test :-/ LGTM

@pkozlowski-opensource
Copy link
Member

@benouat I think that tests need more attention - left an in-line comment.

@pkozlowski-opensource
Copy link
Member

LGTM, going to merge in a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[this._focusTrap is null] Or [Cannot read property 'destroy' of null] When calling close()
3 participants