useBackToClose closes an overlay programmatically (X button or ESC) by setting the module-global suppressPop=true and calling history.back(), so the remaining overlays' popstate handlers ignore that synthetic pop. But the flag was only ever reset by one of those handlers — when the closed overlay had no overlay underneath it (the common single-player case), nothing consumed it and suppressPop leaked true. The next overlay's first real Back then hit the stale true, reset it and returned early without closing — the Back was silently swallowed. Symptom in the YouTube-search flow: close the player with the X button, open another, press Back once -> nothing happens; a second Back closes it AND discards the search results, dumping you on the normal feed. Fix: register a one-shot popstate listener alongside suppressPop=true so the flag is cleared on that very pop even when no overlay remains to consume it. Nesting is unaffected (an underlying overlay still short- circuits first and the one-shot is a redundant no-op). |
||
|---|---|---|
| .. | ||
| public/welcome | ||
| src | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| tailwind.config.js | ||
| tsconfig.json | ||
| vite.config.ts | ||