It collapses and expands based on scroll direction, not position — if this frame's `scrollTop` is greater than the last frame's (scrolling down), shrink the bar to an icon; if it's less, or near the top, expand it back. Unlike a pattern that hides the whole header, the one core action — search — never fully disappears, it just shrinks to an icon.
Unlike a sticky header baked into the layout flow, this bar floats as a separate layer above the content and never pushes it down. Google Maps and the Google app's search bar are the textbook reference for this pattern.
Tapping the collapsed icon should instantly expand it and focus the input — if searching only worked after scrolling all the way back to the top, collapsing it in the first place would defeat the purpose.
When to use
Use it on content-filling scroll screens — maps, feeds — where search should stay within reach without permanently claiming header height.