Closed Enkratia closed 1 year ago
My way to fix it is to add eventListener to element, whose height is changing from js. Click on it after 100ms delay since height is changed. The function is:
const onFixOSBag = (e) => {
const mockElement = document.createElement("span");
mockElement.setAttribute("style", "position: absolute");
e.currentTarget.appendChild(mockElement);
};
This way OS is becoming "aware" that something happened in child elements and recheck their heights. But this is not best practice to do.
Good day @Enkratia
It would be great to have an example for this.. usually changes should be detected by the mutationobserver.. but depending on how you do things they might not be picked up or ignored by it.
A better fix / workaround would be to call the update
function instead of inserting elements.
Thanks for quick answer
Update: problem is not simply about changes of height from js, it`s about changes of height from js in nested OS. (sidebar menu with OS + filters inside of it also have OS)
Real example of what i see and what i mean, reproduction:
F12
(to open console)Ctrl
+ Shift
+ M
(to open toggle device toolbar)What expected: Part of content is not visible, no scroll, no OS
Interesting moment: If to change the order of clicking ("Brand" > "Price" instead of "Price" > "Brand"), everything works fine. OS is working.
P.S.1: May be it's not problem of OS(i myself do something wrong), or this is expected behaviour, i just want to know what it is. I hope reproduction is succeded
P.S.2: update
function change nothing
My bad, i`ve used flex-basis 100%, instead of flex-grow: 1 all the time. This is the reason. Thank you and sorry that i took your time.
@Enkratia Glad you found the issue :)
In the future try to use the update()
function to trigger an update with cached values, and if that isn't working update(true)
to force an update without cache. If neither of those are working its very likely either a bug of and problem on your side.
Describe the bug OS sometimes doesn`t react on changes of height when changes are directly from js.
To Reproduce I have example, but you probably can check it yourself? Or i will send it later.
Expected behavior May be this is expected behaviour? but it would be cool to see this feature in OS.
Environment Environment: React Js, but the same problem with vanilla js was several months ago.
Additional context Thank you for your work.