Fix logo flash and iframe-resizer infinite-scroll on Spaces

#1
by linoyts HF Staff - opened
the-best-team org

Two UI bugs visible on the deployed Space (not locally):

  1. Logo flashes big then becomes tiny. gr.Image was rendered at its default size, then shrunk to 40px once the injected <style> from gr.HTML was parsed. Fix: pass height=40, width=40 to gr.Image so the component is inline-sized at the first paint, before any CSS needs to apply.

  2. Page scrolls to infinity, chat UI unusable. Classic feedback loop between html, body { height: 100vh } and the HF Spaces iframe-resizer: the iframe grows to body.scrollHeight, which causes 100vh to grow, which makes the body taller, which grows the iframe again. overflow: hidden does not break the loop because scrollHeight reports actual content size, not clipped visible size. Fix: drop 100vh on body and pin gradio-app with position: fixed; inset: 0; so the app is removed from document flow โ€” body.scrollHeight stays ~0 and the iframe never grows. The app still visually fills whatever size the iframe gets from its parent.

linoyts changed pull request status to merged

Sign up or log in to comment