The content of the header element has a "jumping effect" when scrolling. This only happens on iOS mobile devices.
The header has sticky
position. If I change it to fixed
position, it fixes the issue, but then the scroll bouncing effect doesn't work well. How is it possible to fix this issue without using fixed position?
The website with the described problem is online and you can see and edit the CSS by inspecting the website in browser.
I tried changing the position, setting the width of the child elements in the header, but nothing fixed the problem.
After further investigation, the issue seems to occur on newer iOS devices, such as the iPhone 13 or newer, and not just in the simulator, as originally assumed.
One "trick" that has helped me a lot in the past with transition/animation issues in Safari (but sometimes in other browsers too) where things get shaky and jumpy, is to force the browser to use "hardware acceleration" so that the browser also uses GPU power instead of just CPU power to render.
There are many articles on this topic because it has been around for a long time, but it is still relevant, and you can read up on it if you are interested in more information:
In your specific case, put the following CSS declaration on the "jumping" SVGs in your sticky header:
transform: translateZ(0);
This seems to stop the "jumping" of the SVGs in your sticky header when scrolling on newer iOS devices.
Since I see a mouse cursor on your GIF, I assume you tested it with an iOS simulator. Is this assumption correct?
If so, this seems to be a problem/bug in the simulator (which is a common thing with simulators because they are not 100% accurate and the same as the original OS/device).
I came to this conclusion because testing the sticky positioned header on a real iOS device (iOS Version 17 on iPhone 11) does not seem to reproduce the unwanted "jumping" effect, as can be seen in the following recording (low-res GIF):