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

Closing modal with escape key prevents it from showing again #256

Closed
Gazler opened this issue Nov 19, 2018 · 12 comments
Closed

Closing modal with escape key prevents it from showing again #256

Gazler opened this issue Nov 19, 2018 · 12 comments
Assignees
Labels
bug critical issue

Comments

@Gazler
Copy link

Gazler commented Nov 19, 2018

It appears that there is an issue with closing the modal using the escape key on version 4. I know there are a few issues related to modal display issues, so perhaps it is a regression of some sort?

To trigger the issue, open a modal, press escape, then try opening the modal again. The modal should display, then immediately disappear.

For convenience, here is a script to replicate it on the demo application:

http://thednp.github.io/bootstrap.native/

var el = document.querySelector('button[data-target="#myModal"]'); 
el.click(); 
setTimeout(() => {
  var e = new Event("keydown"); 
  e.keyCode = 27; 
 document.dispatchEvent(e)
}, 300); 
setTimeout(() => {el.click()}, 1000)

We have also observed this behaviour with clicking on the backdrop to dismiss, and via a data-dismiss attribute.

@thednp thednp added the cannot duplicate works with the demo label Nov 19, 2018
@thednp
Copy link
Owner

thednp commented Nov 19, 2018

I cannot duplicate the issue, works for me on Windows 10 with EDGE, Opera, Chrome and Firefox.

Are you on a MAC?

@Gazler
Copy link
Author

Gazler commented Nov 19, 2018

I'm on Linux (Ubuntu), a colleague also on Linux (Arch Linux) was able to replicate. Will try a different OS to see if I can replicate.

Have tried Chrome and Firefox.

@midzer
Copy link
Contributor

midzer commented Nov 19, 2018

Can't duplicate, too. I close via ESC key and can open modal again.

(using debian testing, latest chromium)

@ktec
Copy link

ktec commented Nov 19, 2018

Able to replicate the behaviour on a Mac using Chrome by the following:

  1. Visit http://thednp.github.io/bootstrap.native/
  2. Click the modal button, it works as expected.
  3. Open dev tools. Run the script:
var el = document.querySelector('button[data-target="#myModal"]'); el.click(); setTimeout(() => {var e = new Event("keydown"); e.keyCode = 27; document.dispatchEvent(e)}, 300);
  1. Now when you click the Modal button it consistently shows then disappears.

HTH

@ktec
Copy link

ktec commented Nov 19, 2018

Able to replicate on Arch / Chrome too.

@thednp
Copy link
Owner

thednp commented Nov 19, 2018

Do you guys have a console error?

@Gazler
Copy link
Author

Gazler commented Nov 19, 2018

Here's a recording of it triggering including the console (using the code snippet from the original issue.)

bootstrap

@Gazler
Copy link
Author

Gazler commented Nov 19, 2018

I was also able to replicate on EDGE, chrome and Firefox on Windows 10 with the script above.

bootstrap-native

@thednp
Copy link
Owner

thednp commented Nov 19, 2018

Let me get this right. Are you telling me that you've written a script to loop an "open-close" and proves our component is doing things wrong? I mean our script isn't bullet proof in that scenario, I don't think any script is.

@Gazler
Copy link
Author

Gazler commented Nov 19, 2018 via email

@thednp
Copy link
Owner

thednp commented Nov 19, 2018

I will have a look at this asap, I think the ESC KEY event handler should be scheduled to start later.

Thanks for reporting.

@thednp thednp closed this as completed in 36f9798 Nov 19, 2018
thednp added a commit that referenced this issue Nov 19, 2018
@thednp
Copy link
Owner

thednp commented Nov 19, 2018

@Gazler please test the latest master, demo page also updated.

@thednp thednp added bug critical issue and removed cannot duplicate works with the demo labels Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug critical issue
Projects
None yet
Development

No branches or pull requests

4 participants