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

After closing once and reopening, modal cannot be dismissed #9362

Closed
icebits opened this issue Aug 12, 2013 · 8 comments
Closed

After closing once and reopening, modal cannot be dismissed #9362

icebits opened this issue Aug 12, 2013 · 8 comments
Assignees
Milestone

Comments

@icebits
Copy link

icebits commented Aug 12, 2013

Hi,

The code used on last Thursday worked fine. But after updated to latest code on Monday (GMT+8), the modal dialog when clicks to dismiss for seconds onward cannot be close.

I am checking on source code line 932, if I commented out this line then it is working again.

this.$element
.removeClass('in')
.attr('aria-hidden', true)
//.off('click.dismiss.modal')

Am I missing anything...?

Sorry for the grammar. Thanks.

@cvrebert cvrebert reopened this Aug 12, 2013
@cvrebert
Copy link
Collaborator

Sorry, I don't understand what you mean by "when clicks to dismiss for seconds onward".
Could you perhaps give a list of steps to intentionally cause the problem?

@icebits
Copy link
Author

icebits commented Aug 12, 2013

Hi. Basically the steps very easy. I just need to write sample html as below:

 <a data-toggle="modal" href="#myModal" class="btn btn-primary">Launch modal</a>
  <div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Test</h4>
        </div>
        <div class="modal-body">
          Test
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>

When I clicks the "Launch modal" button, the modal will show up, then I clicks "Close" button to close the modal. After the modal has hidden, I clicks the "Launch modal" button again (second times), then clicks "Close" button, the modal will not hide, it is still opening.

Then, I compare bootstrap js which from last Thursday and Today version, found out that the following codes on Line 932 might causing issue:

this.$element
  .removeClass('in')
  .attr('aria-hidden', true)
  .off('click.dismiss.modal')

I need to comment out .off('click.dismiss.modal') to make the close button working again. I am not sure whether it is related to bug fix #9111.

Sorry, how to write the code block?

Thanks.

@cvrebert
Copy link
Collaborator

Sorry, how to write the code block?

Using triple-backticks. It's explained in the "Comments are parsed with GitHub Flavored Markdown" link in the comment box. I've gone ahead and fixed your comment for ya.

@cvrebert
Copy link
Collaborator

Confirmed: http://jsfiddle.net/SVXZa/1/
(@icebits: for future reference, we prefer a jsFiddle for bug examples)

@Lalem001
Copy link

#9548 Mentions this issue may be related to a change made in commit a4f0e8d. Could be worth looking at.

@fredimachado
Copy link

Yep. Reverting this commit it works fine. (Sorry for the duplicated issue tho)

@cvrebert
Copy link
Collaborator

We should add a testcase for this...

@cvrebert
Copy link
Collaborator

Note: The modal can still be dismissed the 2nd+ times by clicking the backdrop, but the "x" and "Close" buttons indeed don't work.

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

No branches or pull requests

5 participants