Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

Modal: Bad position on second show

Open mishak87 opened this issue 12 years ago • 64 comments

When modal showed for second time it "falls" half bellow screen.

var self = $('.ui.modal');
self.modal({
  onShow: function () {
    self.modal('refresh'); // does NOT help
    setTimeout(function () {
      self.modal('refresh');
    }, 1000); // does help 1s is probably overkill
  }
});

My uneducated guess is position is computed and set only first time when modal is shown and second time default CSS makes it fall.

Modal includes some generated items by KnockoutJS but items are not added between shows.

mishak87 avatar Feb 10 '14 21:02 mishak87

I can't reproduce any issues from modal docs related to positioning.

Can you make a jsfiddle?

jlukic avatar Feb 11 '14 05:02 jlukic

OTR I sent you private demo on your email.

mishak87 avatar Feb 11 '14 12:02 mishak87

Same problem as you. I noticed that after window being closed, margin-top property has still a value. If I set it to 0 via Chrome Inspector it'll show up properly. Even on docs page (http://semantic-ui.com/modules/modal.html) problem occurs. Clicking on "run code" for the second time returns non-centered modal. Any ideas?

iamhatesz avatar Feb 26 '14 01:02 iamhatesz

Same problem for me

ab192130 avatar Feb 26 '14 10:02 ab192130

This isnt occurring for me in Chrome/Safari/FF.

Can someone give me their exact browser version and OS who can see this issue?

jlukic avatar Feb 27 '14 14:02 jlukic

OS: Microsoft Windows 7 HP (build 7601, Service Pack 1, latest updates) Browser: Google Chrome 33.0.1750.117 m (latest for me)

iamhatesz avatar Feb 27 '14 14:02 iamhatesz

I'm seeing this in chrome as well on windows 7. This is a bug will fix ASAP

jlukic avatar Feb 28 '14 04:02 jlukic

:heart:

mishak87 avatar Feb 28 '14 13:02 mishak87

Having same issue, ff/chrome/opera @ ubuntu 14.04 b2

rottingcorpse avatar Mar 28 '14 12:03 rottingcorpse

It looks like having a set height on the modal fixes this issue for me

hacknightly avatar Mar 30 '14 21:03 hacknightly

same here problem is solved by setting explicit height of modal...

lucidNTR avatar Apr 04 '14 01:04 lucidNTR

bug is still reproduced

FrostBy avatar Apr 11 '14 08:04 FrostBy

Thanks, could anyone create a JSFiddle that will reproduce the issue?

This might be related to having a parent with a 3D acceleration trigger like backface-visibility or transform

jlukic avatar Apr 11 '14 13:04 jlukic

@jlukic I have reproduced the error due to the overridden ".hidden" property .hidden{ display: none!important; } http://jsfiddle.net/d93af/13/

FrostBy avatar Apr 11 '14 14:04 FrostBy

I'm using FF 28, Windows 8 and cannot reproduce the error using your JSFiddle.

Am I missing something?

jlukic avatar Apr 11 '14 14:04 jlukic

My problem was caused by .hidden with !important as well. +1

P.S. Linux ff latest stable, chromium latest stable

rottingcorpse avatar Apr 11 '14 14:04 rottingcorpse

@jlukic see the link below http://goo.gl/ATWsaS

FrostBy avatar Apr 11 '14 14:04 FrostBy

It looks like modals were rebuilding cached sizes on every show instead of just on browser resize. Bad!

I've also fixed modals to work with css that has a rule like .hidden { display: none !important; }

jlukic avatar Apr 22 '14 03:04 jlukic

I have the problem with wrong position on 2+ show. It works OK with semantic 0.15.5. Newest version still have this bug, but when the document or window size is changed, margin of the modal is fixed.

Windows 8 Chrome 34

kwolniak avatar May 12 '14 13:05 kwolniak

@kwolniak Are you having this problem on the docs page or just your site? Can you provide a test-case for this error with latest SUI?

jlukic avatar May 12 '14 21:05 jlukic