-
-
Notifications
You must be signed in to change notification settings - Fork 335
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] not all changes are observed even with observeChanges: true
#2476
Comments
|
I rejected my proposed changes from the mentioned PR as a fix for this use case does not seem to be trivial (see PR comments) |
The #2477 PR discovered observing the changed size is easy, but the problem is a modal refresh (called when a change is observed) is currently problematic, it is breaking/stopping a mouse drag. https://jsfiddle.net/v2q30wsx/1/ confirms an observer itself isn't causing the drag event to stop. |
The refresh is the intention of the Mutationobserver. I debugged it down to the setting of the scrolling class which are causing the issue Fomantic-UI/src/definitions/modules/modal.js Lines 1104 to 1105 in 1ff8bfd
When this happens, the browser internally seems to adjust the viewport height which in turn seems to break the Observer as its base (the changed style) again changes in the same context, although it should only observe the modals changes, not the dimmer and not body. I tried to do the refresh asynchronously and also tried to disconnect the observer , then do the refresh, then restart the observer, but this does not fix it. The window resize event also does a refresh (via requestanimationframe, but i tried this in the observer as well without success) but the windows resize event seems to work differently as it does not bug there. This was really giving me a headache today |
Not sure if it helps, but as long we need to monitor the modal size change only (and no changes inside),
|
Just tried that, also does not work in firefox blocks drag when reaching end of viewport just as before if('ResizeObserver' in window && settings.observeChanges) {
observer2 = new ResizeObserver(function(mutations) {
module.refresh();
});
observer2.observe(element);
} works fine in chrome though |
When an empty observer callback (/wo modal refresh) is called, the drag is working. So it seems some operation in the modal refresh is causing the drag to stop. Maybe some DOM operation there can be done differently. |
Any attribute in https://github.com/fomantic/Fomantic-UI/blob/afea456/src/definitions/modules/modal.js#L311 should be observed as any attribute can be used in CSS selector, ie. can change modal height. The "dragging" problem in Firefox is not caused by observer itself. The problem is |
another repro:
|
I tried to reproduce this in a simple jsfiddle using a simplified variant of your modal When i select anything from the dropdown, the modal does not move. Is something else happening in your code when you select anything from the dropdown? |
here is working repro - https://jsfiddle.net/qLog153p/ - |
I still cannot get this to happen (tried edge/chrome/firefox/70% browser zoom, windows 11) I just want to figure out the reason before "just" adding the refresh back to the show method as i believe we might have to fix something else (too) |
please try different zoom levels in Firefox, the reason is when modal is too big, the centering is not applicable, when the modal is too small, the extra dropdown height has no effect exact repro steps:
please give it at least several tries (for each fresh refresh and setting a browser zoom level), I have noticed I was not able to reproduce it if the browser window width! was too small, not sure why, maybe it is subject to some race conditions |
But, if I refreshed the page at zoom level 150%, then I couldn't reproduce this anymore. I tried several zoom level and it doesn't move a bit. I could only reproduced with initial zoom level is less than 150% and the modal shifted to the top when zoom in to 150%. I tried with the initial zoom level >= 150% and then zoom out to 150% and below and the modal is still working fine. |
Finally fixed by #2969. Reason why firefox bugged back then was the ::after selector to keep a bottom margin |
Bug Report
When I modify the demo from #2036 with textarea - https://jsfiddle.net/2w493cyo/1/ - and resize the textarea vertically to force the modal height to be greater than the viewport, no scrollbar is shown. But when I change/maximalize browser window size, it trigger some internal change and scrollbar is added, even if nothing in the modal is changed. It seems not enough changes are observed.
Steps to reproduce
Expected result
Actual result
no vertical scrollbar after modal height overflow
The text was updated successfully, but these errors were encountered: