Skip to content

fix: unload web splash image after the first frame - #836

Open
ak-cipher wants to merge 1 commit into
jonbhanson:masterfrom
ak-cipher:fix-815-web-splash-selectable
Open

ak-cipher wants to merge 1 commit into
jonbhanson:masterfrom
ak-cipher:fix-815-web-splash-selectable

Conversation

@ak-cipher

Copy link
Copy Markdown

Problem

On Flutter web, the splash <picture> stays in the page after the app is drawn. Chrome on Android can still long-press that hidden image. removeSplashFromWeb() only runs when the app calls FlutterNativeSplash.remove(), so the default setup never unloads it.

Fixes #815

Changes

  • Unload each splash image (src / srcset) and remove #splash and #splash-branding when Flutter dispatches flutter-first-frame.
  • Keep those images non-selectable while they are on screen.
  • preserve() still holds the splash, because it delays that first frame until remove().

Verification

In the example app, with preserve() and remove() commented out:

  • Before: document.getElementById("splash") returned the <picture>, currentSrc was splash/img/dark-2x.png, and the hit list was FLUTTER-VIEW, IMG, BODY, HTML.
  • After regenerating web/index.html and reloading: document.getElementById("splash") was null, currentSrc was undefined, and the hit list was FLUTTER-VIEW, BODY, HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrome Android Splash image is selectable over the app content after it is removed

1 participant