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

Modal: resizing/transition issue on every current browser #2221

Closed
ghost opened this issue Oct 20, 2017 · 18 comments · Fixed by #3679
Closed

Modal: resizing/transition issue on every current browser #2221

ghost opened this issue Oct 20, 2017 · 18 comments · Fixed by #3679

Comments

@ghost
Copy link

ghost commented Oct 20, 2017

Hi,

we found a bug while using the semantic react dialog component.

--> Animiated Gif to show the effect <--

We can repoduce this error on
https://react.semantic-ui.com/modules/modal#modal-example-dimmer
but not with the jquery version.
So it seems a css problem base on adding / removing the scrolling class by react.

The main problem is, thats a edge case failure, that can only be repoduced if the modal dialog / the body tag will add / remove the scrolling css class and also the height and width are so chosen that the dialog doesnt fit the browser windows by missing some pixels in height and width.

For own dialogs with larger content this happens on normal sized pages, so many users of our site get this problem, when they have a special resolution.

Steps

Open the default modal dialog dimmer example with

chrome with a html / body size of width: 345px / height: 583px
firefox with a html / body size of width: 337px / height: 574px
EDGE with a html / body size of width: 332px / height: 576px

We cant repoduce the behavior with the device emulation mode on the chrome dev tools.

Expected Result

Stable Layout

Actual Result

The modal dialog is switching between scolling and not scrolling.
We think the recalculation by react adds the scrolling class to the body and also to the modal dialog and remove this again and add this again and so on.

Its toggling between (on the chrome example)

<body class="dimmable dimmed">
...
<div class="ui modal transition visible active" style="margin-top: -289px;">

and

<body class="dimmable dimmed scrolling">
...
<div class="ui scrolling modal transition visible active" style="margin-top: -294px;">

Also seen on the react component

<div class="ui modal transition visible active" style="margin-top: -289px;">

<div class="ui scrolling modal transition visible active" style="margin-top: -294px;">

@layershifter
Copy link
Member

Looks like duplicate of #1867.

@ghost
Copy link
Author

ghost commented Oct 25, 2017

Hi,
we spend some time to analyse the problem and compare the behaviour with the semantic ui (jquery).

We don't understand, why the scrolling css class was calculated based on component and window inner height.

const scrolling = height >= window.innerHeight

In semantic ui (jquery) its a setable property and was not calculated by the component itself. With a property scrolling:true/false the flickering will be gone. Its verfied by modifing react semantic ui.

Alternatively it would be an option to controll the scrolling from outside additionally.

Thx

@levithomason
Copy link
Member

Thanks for the investigation. SUIR calculates a few properties for developer convenience. In this case, a Modal that extends taller than the screen should become scrollable. Modals that fit within the screen height do not need to be scrollable. This is always true and not applying the class in these cases would produce a "broken" UI for the user.

That said, the issue is that the Modal margin was not taken into account in the calculation. I've fixed this locally, but it needs to be cleaned up for a PR.

A fix would be to measure the height + border + margin of the modal without the scrolling className and if that fits the viewport, then the Modal is not scrolling.

Currently, the measurement doesn't differentiate between scrolling or non-scrolling modals. It also doesn't consider the border and margin, it only considers the height. The height changes when going from non-scrolling to scrolling, due to the inclusion of outer margin when scrolling.

@zurez
Copy link

zurez commented Nov 3, 2017

@levithomason Any ETA on fix?

@toolaugh
Copy link

toolaugh commented Nov 15, 2017

im too ,help me please

@brianespinosa
Copy link
Member

@zurez @toolaugh PRs are welcome for any issues tagged as bug and help wanted.

@levithomason
Copy link
Member

No ETA. Please use SO and Gitter for help requests. GitHub is reserved for performing work.

@stale
Copy link

stale bot commented Mar 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 10, 2018
@Glathrop
Copy link

className="scrolling" is a workaround for this.

@stale stale bot removed the stale label Mar 21, 2018
@Tydax
Copy link

Tydax commented Mar 23, 2018

@Glathrop Just discovered that, thanks for this workaround.
You can also change the margin-bottom property to auto of the Modal if you want to prevent the modal from taking the whole height if it doesn't need to.

@layershifter
Copy link
Member

Can you check please the latest release with SUI 2.3?

@bavicj
Copy link

bavicj commented Jul 2, 2018

I have the same problem since I updated to versions 0.81.x. With 0.80.x everything was OK.
GIF example

@layershifter
Copy link
Member

Please add a minimal repro case on codesandbox.

@layershifter layershifter changed the title [Modal][Dimmer?] resizing/transition issue on every current browser Modal: resizing/transition issue on every current browser Jul 10, 2018
@stale
Copy link

stale bot commented Jan 6, 2019

There has been no activity in this thread for 180 days. While we care about every issue and we’d love to see this fixed, the core team’s time is limited so we have to focus our attention on the issues that are most pressing. Therefore, we will likely not be able to get to this one.

However, PRs for this issue will of course be accepted and welcome!

If there is no more activity in the next 180 days, this issue will be closed automatically for housekeeping. To prevent this, simply leave a reply here. Thanks!

@stale stale bot added the stale label Jan 6, 2019
@grean
Copy link

grean commented Jan 10, 2019

I personnaly fix this by adding those two lines on my modal component. The height value depending of your needs, for me it was 300..

<Modal
   ...
   className="scrolling"
   style={{maxHeight:'300px'}}
>...</Modal>

@ktaras
Copy link

ktaras commented Mar 13, 2019

Just adding class scrolling doesn't help.
It fixes flickering, but when the content is large there is no scrollbar and the content just overflows through the modal borders. Any other suggestions? Maybe scrolling should be applied in complex with some other adjustments?

It happens after upgrading to 0.81 and later versions. 0.80.2 is ok.

@mgrivera
Copy link

Hi, I must say I'm very new to react & semantic-ui as well.
So, version 0.80.2 is Ok, I assume for semantic-ui-react; I currently have version 0.86.0 and experiencing the issues mentioned here.
My question is: what version should we use for semantic-ui-css; I currently am using version 2.4.0. But what version should I use for Modal to behave correctly?
Thanks and bye ...

@layershifter
Copy link
Member

I provided a fix in #3679, please try it, feedback there is much appreciated 🙌

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

Successfully merging a pull request may close this issue.