Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(modal): shift+tab without focused element within modal #5294

Closed
wants to merge 1 commit into from
Closed

fix(modal): shift+tab without focused element within modal #5294

wants to merge 1 commit into from

Conversation

AndriIushchuk
Copy link
Contributor

Closes #5229

@icfantv
Copy link
Contributor

icfantv commented Jan 18, 2016

@AndriIushchuk, please fix the broken tests. Thanks.

@icfantv
Copy link
Contributor

icfantv commented Jan 18, 2016

Also, just a tip, you can run the tests locally without committing them simply by executing the grunt command from the top level directory of the repo on your local system.

@AndriIushchuk
Copy link
Contributor Author

@icfantv thanks for the tip, tests fixed

@icfantv
Copy link
Contributor

icfantv commented Jan 18, 2016

Thanks. I'll mark for review as I admit I don't know this code well enough to sign off on it.

if (evt && modalWindow) {
var modalDomEl = modalWindow.value.modalDomEl;
if (modalDomEl && modalDomEl.length) {
return (evt.target || evt.srcElement) === modalDomEl[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

This might need to check whether it contains the element using contains.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But by using contains, method will return true for each tabbable element within modalWindow

Copy link
Contributor

Choose a reason for hiding this comment

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

The name of the function is not quite right if that is the case then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about $modalStack.isModalFocused?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds reasonable

@@ -606,11 +606,15 @@ describe('$uibModal', function() {
template:'<a href="#" id="tab-focus-link"><input type="text" id="tab-focus-input1"/><input type="text" id="tab-focus-input2"/>' +
'<button id="tab-focus-button">Open me!</button>'
});
$rootScope.$digest();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this extra $digest necessary? This seems a little suspicious to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's necessary to update focused element after modal opening

@wesleycho
Copy link
Contributor

Verified here this looks good - thanks for the fix!

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

Successfully merging this pull request may close these issues.

None yet

3 participants