Description
Recently, docs.rs gained a fixed header bar. To accommodate this, all other content on the page was moved into an overflow: auto
div of some kind. This is a problem. For context, there are two kinds of scrolling used on websites in Safari on an iPhone:
- Inertial scrolling, keeps moving until simulated friction stops it after you lift your finger. Covers a lot of ground very quickly but allows precise scrolling at low speed. Also has some priority over child type 2 elements for determining which content to scroll.
- Locked panning, 1:1 with touch movement, stops dead when finger lifts.
Type 1 is used for entire pages where the document is larger than the viewport. Type 2 is used for overflowing content, e.g. wide code blocks clipped to viewport width, scrolling horizontally.
It used to be that docs.rs pages were bigger than the viewport, and scrolled with type 1. Now that the entire page is in an overflow: auto
div, Type 2 is used on everything. This means:
- Scrolling is slow, because no inertia. Docs pages are very long!
- You can get stuck in code blocks that are viewport height or larger. Because they take priority on touch events for scroll, you actually cannot scroll the page while they take over the screen. All touches are interpreted as locked horizontal pans, no matter how vertically you move your finger. Fortunately there is a small white margin on the left that allows (type 2) page scrolling, so you can get out, but it’s pretty bad.
- You can’t use the “tap status bar to scroll to top” feature any more.
Together, this is very painful UI. I use docs.rs from my phone every day. Please use position: fixed
for fixed position navigation bars, or don’t do them at all.