Skip to content

fix: Mobile banner close button dismisses the wrong banner and leaves a ghost element - #13270

Closed
reddam-charan-teja-reddy wants to merge 4 commits into
openfoodfacts:mainfrom
reddam-charan-teja-reddy:fix/mobile-banner-close-behavior
Closed

fix: Mobile banner close button dismisses the wrong banner and leaves a ghost element#13270
reddam-charan-teja-reddy wants to merge 4 commits into
openfoodfacts:mainfrom
reddam-charan-teja-reddy:fix/mobile-banner-close-behavior

Conversation

@reddam-charan-teja-reddy

Copy link
Copy Markdown

What

On mobile, the survey/donation banner (donate_banner.tt.html) and the app-download banner (site_layout.tt.html) share the same screen space. When a user dismisses the survey banner, two problems occur:

  1. Ghost close button — the banner is hidden with display: none but its absolutely-positioned close button remains visible and clickable in the DOM, overlapping the app-download banner.
  2. Wrong banner dismissed — tapping that ghost "×" fires the survey banner's dismiss handler instead of closing the app-download banner, confusing users.

Root cause: A premature </section> tag in donate_banner.tt.html placed the close button outside its parent section, and display: none on the parent didn't affect it. The app-download banner also had no close button of its own.

Changes:

  • donate_banner.tt.html

  • site_layout.tt.html

  • scss/_off.scss

  • Replaces bannerID.style.display = 'none' with bannerID.remove() so dismissed banners are fully removed from the DOM

  • Adds a close button with cookie-based persistence to the mobile app-download banner in site_layout.tt.html, with supporting styles in _off.scss

Large Language Models usage disclosure

Used GitHub Copilot (Claude Opus 4.6), for investigating the root cause, and implementing the fix.
All changes were tested locally on http://world.openfoodfacts.localhost/ in mobile view.

Screenshot or video

Before: Not possible to dismiss the banner

image

After: Both the banners can be dismissed with their respective close button

image

After closing

image

Related issue(s) and discussion

@reddam-charan-teja-reddy
reddam-charan-teja-reddy requested a review from a team as a code owner March 9, 2026 17:12
@github-actions github-actions Bot added CSS Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🎁 donations Site layout labels Mar 9, 2026
@github-project-automation github-project-automation Bot moved this to To discuss and validate in 🍊 Open Food Facts Server issues Mar 9, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Mar 23, 2026
@teolemon teolemon moved this to In progress in 🎁 Donations Aug 5, 2026
@teolemon teolemon moved this from To discuss and validate to In Progress in 🍊 Open Food Facts Server issues Aug 5, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in 🎁 Donations Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS 🎁 donations 💥 Merge Conflicts 💥 Merge Conflicts Site layout Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Banner close button on mobile dismisses the wrong banner and leaves a ghost element

2 participants