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 causes layout issues on the page #19882

Closed
pallymore opened this issue May 11, 2016 · 6 comments
Closed

closing modal causes layout issues on the page #19882

pallymore opened this issue May 11, 2016 · 6 comments

Comments

@pallymore
Copy link

pallymore commented May 11, 2016

Hello,

I'm using Boostrap 3.3.6 and recently ran into a puzzling issue with the modal component.

Here's a jsfiddle to recreate this: http://jsfiddle.net/14qjajoh/
Browsers tested: latest Chrome & Firefox.

So I have a box container, which has two boxes, the 2nd one contains actions, and only shows up when the box container is hovered.
When I close the modal, the boxes are moved to the top...for no reason?
Clicking on the box itself fixes the layout though...

Is there anything wrong with my code?

Thanks!
P

===== more info

this only happens when the modal is invoked by clicking the button.
if it is displayed with javascript

// in console. 
$('#modal').modal();

then layout won't be affected after closing the modal (by using the Close buttons)

@mdo
Copy link
Member

mdo commented May 11, 2016

Perhaps the button is snagging focus and jumping you back to it?

@pallymore
Copy link
Author

Interesting. Same issue occurs when I focus on the button with JS $('a').focus();
still not sure why it's making box-1 to move up though.

@pallymore
Copy link
Author

Hmm It seems it's a browser behavior, not a bootstrap issue.
I will try to figure it out.

Thanks for your help!

@pallymore
Copy link
Author

checked previous pull requests.
It seems bootstrap is partially responsible - it tries to focus on the triggering element when the modal is closed as long as the modal .is(':visible') - since that jQuery considers anything that takes up space in the document is visible, it will focus on the button no matter if it's visibility: hidden or opacity: 0 or being hidden by overflow: hidden;

original pull request
#13627

I think the pull request makes sense for accessibility reasons, but I think it's better if it checks if the element is actually in port of view, instead of checking if it is taking up space in the document. Thoughts?

I updated CSS to fix this issue:
http://jsfiddle.net/14qjajoh/3/

@cvrebert
Copy link
Collaborator

Sounds like a uncommon enough case that I'm not sure it's worth handling.

CC: @patrickhlauke

@cvrebert cvrebert changed the title closing modal causes layout issues on the page (v3) closing modal causes layout issues on the page Jul 12, 2016
@mdo
Copy link
Member

mdo commented Sep 5, 2016

Bootstrap 3 is no longer being officially developed or supported.

All work has moved onto our next major release, v4. As such, this issue or pull request is being closed as a "won't fix." For additional help and support, we recommend utilizing our community resources. Thanks for your understanding, and see you on the other side of v4!

<3,
@mdo and team

@mdo mdo closed this as completed Sep 5, 2016
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

3 participants