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

Modals return focus to [data-target="modal"] on hidden #13612

Closed
wants to merge 1 commit into from

Conversation

bassettsj
Copy link
Contributor

Resolves issue #12364

  • small change in the data api to trigger focus on lauch element
  • attempt to write a test (HELP Needed!)

@bassettsj
Copy link
Contributor Author

Sorry for opening an incomplete PR, but I am spending way too much time trying to write the unit test and feel like it might be fixed easily with a little help. I have tried many times to get the test to pass, but the event doesn't seem to fine in Quint, but when I test in my browser it works as expected, so I am confused here.


var triggered
var div = $('<div id="modal-test"><div class="contents"></div></div>')
var button = $('<a href="#mdoal-test" data-toggle="modal"></a>')
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo: "mdoal"

@cvrebert
Copy link
Collaborator

Your problem might be related to ariya/phantomjs#10427 .
Perhaps try checking document.activeElement instead, as suggested by some of the commenters in that issue.

@cvrebert cvrebert added the js label May 16, 2014
@cvrebert cvrebert added this to the v3.2.0 milestone May 16, 2014
@@ -1076,6 +1076,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
Plugin.call($target, option, this)
$target.one('hide', function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't this take care of it anyways, wouldn't changing it form .one() to .on() take care of the issue?

Resolves issue twbs#12364

- small change in the data api to trigger focus on lauch element
- attempt to write a test (HELP Needed!)
@bassettsj
Copy link
Contributor Author

For the life of me I cannot get this to pass even in the browser. I am suspect that the events don't fire due to qunit-fixture div not being visible. Anyways, any help would be great!

@cvrebert
Copy link
Collaborator

Quasi-duplicate of #4257.

@cvrebert
Copy link
Collaborator

So, essentially, we seem to already have code that's supposed to do this, it just seems to be broken somehow.

@cvrebert
Copy link
Collaborator

Superseded by #13627. Thanks for giving me a reason to look more closely at the existing code though.

@cvrebert cvrebert closed this May 19, 2014
@cvrebert cvrebert removed this from the v3.2.0 milestone May 19, 2014
@bassettsj
Copy link
Contributor Author

Glad this guy is closed. Felt unmotivated with the tests

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

Successfully merging this pull request may close these issues.

2 participants