bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Modal - Screen Flickers on Open and Hide

Open r1c4r60 opened this issue 13 years ago • 33 comments

Anyone else?

r1c4r60 avatar Jul 29 '13 11:07 r1c4r60

What browser and OS?

cvrebert avatar Jul 29 '13 11:07 cvrebert

can be verified at: http://twbs.github.io/bootstrap/javascript/#myModal

Chrome: Version 28.0.1500.71 Mac: 10.6.8

r1c4r60 avatar Jul 29 '13 11:07 r1c4r60

Doesn't flicker for me and I'm using Chrome: Version 28.0.1500.71 and Mac: 10.8.4.

leeaston avatar Jul 29 '13 11:07 leeaston

Do you mean when you open the model the screen shifts for a second?

As whats happening when you open the model you get 2 scroll bars for a seconds and when closing you lose the scroll bar for a second.

Chrome: Version 28.0.1500.71 Windows 8

ghost avatar Jul 29 '13 11:07 ghost

maybe this is what? when we open the left side there?

http://www.screenr.com/arpH

chrome 30.0.1573.2 dev-m windows 7

kukac7 avatar Jul 29 '13 12:07 kukac7

@kukac7 I noticed 3 things:

1 - When the Modal shows - the parent document's indent shifts right. On close it shifts back. 2 - Flickering can be repeated with Safari as well - probably something to do with the item 1. 3 - On Mac + Chrome - While the flicker happens, at times, chrome will become "translucent" for an instant and you will be able to see any windows behind it.

screen shot 2013-07-29 at 3 31 21 pm

r1c4r60 avatar Jul 29 '13 12:07 r1c4r60

@r1c4r60 Pretty sure (3) is a general Chrome bug. I've experienced it several times recently on various sites.

cvrebert avatar Jul 30 '13 02:07 cvrebert

Flicker for me and I'm using Chrome: 28.0.1500.72 m (Windows 7). For a few seconds the scrollbar is duplicated, during the opening. I think this may be causing the problem.

duplicate-scrollbars

andrelom avatar Jul 30 '13 14:07 andrelom

It does it for me with Windows7/Firefox 22.0 also.

aoldf2 avatar Aug 01 '13 18:08 aoldf2

I'm having the same "flicker" effect on Chrome 28.0.1500.95 and Firefox 22 (on Windows 8).

What I'm seeing is :

On http://getbootstrap.com/javascript/ : main page scrollbar is replaced by modal scrollbar (with a slight overlap (2 scrollbars) during css transition)

On my site : the scrollbar disappears (because my Modal has no overflow), but the scrollbar of the page reappears only if the modal is hidden using data-dismiss="modal", and NOT if calling the "hide" method, or for instance :

$(this).on('hidden.bs.modal', function() {
                // do stuff
        $(this).remove();
    }
}).modal('hide');

What happens then is that my page is stuck : I'm unable to scroll up or down...

I'm new to Github, hope that helps!

Marcpepe avatar Aug 01 '13 20:08 Marcpepe

This does happen on Vista FF22.

Merg1255 avatar Aug 02 '13 16:08 Merg1255

As far I understand, everyone must have this issue. It is not browser specific.

Screen flickers during animated Modal opening/hiding because of double scrollbars:

  • First scrollbar for body - it is not hidden yet.
  • Second scrollbar for modal - it is shown already.

krasnoperov avatar Aug 02 '13 21:08 krasnoperov

The problem occurs on OSX if you don't have the iOS-style scrollbars activated. The iOS-style scrollbars overlay the page instead of indenting it, so the issue is not visible. But in OS/Browser environments that use 'static' scrollbars you get the issue as seen in the screenshot by @andrelom.

A possible solution (Facebook does this, for example):

  • use .modal-open to set the container behind the modal to position:fixed (this kills the scrollbar)
  • set the top value of the container behind the modal to -{{scrollTop}} (this keeps the container at its previous scroll position)

It's not what you would call pretty. It's also not ideal for Bootstrap because it requires a specific HTML setup.

I'm very curious to see if/how this gets solved. This issue makes opening and closing of modals pretty whack on affected systems.

timeinfeldt avatar Aug 05 '13 16:08 timeinfeldt

It doesnt fix the issue for me. Working on Windows 7 with Chrome 28.0.15000.95 m.

FabianKoestring avatar Aug 06 '13 08:08 FabianKoestring

If you want quick solution until official fix:

At first, define several styles:

// Show scroll for modal only when modal is opened
.modal {
  overflow-y: hidden; 
}
.modal-open .modal {
  overflow-y: scroll;      
}

// Fix page shift when body scroll is killed
.modal-open .modal-shiftfix,
.modal-open .modal-shiftfix .navbar-fixed-top,
.modal-open .modal-shiftfix .navbar-fixed-bottom {
  overflow-y: scroll;      
}

Then wrap entire page into .modal-shiftfix div

<body>
  <div class="modal-shiftfix">
  .....
  </div>
</body>

P.S. Tested in Chome/Firefox/Safari for Mac and IE8/Opera for Windows

krasnoperov avatar Aug 06 '13 09:08 krasnoperov

#9419

Merg1255 avatar Aug 14 '13 10:08 Merg1255

I noticed that it happened to add 15pixel margin on the right... not sure why, but I added this as a custom style, and no more issues with the shifting.

The first set fixes the issue with the body shifting over, the second corrects the navbar from shifting, obviously you only need the second if you are making use of the navbar.

body.modal-open{ margin-right:0px!important; }

.modal-open .navbar-fixed-top{ margin-right:0px!important; }

Mediarts avatar Aug 26 '13 17:08 Mediarts

I'm not sure whether it helps you, but I'm also using Chrome (29.0.1547.62) on a Mac (10.7.5) and I don't have 'double scrollbars' or anything like that, but rather when the modal showing animation has finished, it flickers once. Also when the closing animation has finished, it flickers once (so for 0.1 second, I can see the modal again in the middle of the screen, which just finished it's closing animation).

IsaiahvH avatar Aug 30 '13 15:08 IsaiahvH

Ditto here, seeing it on Mac w/ Chrome 29.0.1547.65.

hlship avatar Sep 03 '13 21:09 hlship

The 15px shift is covered by #9855.

cvrebert avatar Sep 03 '13 22:09 cvrebert