[Bug]: Hidden Nearby map overlaps the active tab after returning to the app from background/lock screen

Open
#7,483 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@dkrrish9 is already working on this.

Since Nov 30, 2026.

Assessment

This issue has not been assessed yet.

Description

Summary

Starting from a fresh launch, if we open a tab (like Contributions or Bookmarks/Explore before visiting Nearby), then visit the Nearby tab and switch back to that earlier tab, leaving the app (going to Home, switching to another app via Recents or locking the device) and coming back causes the Nearby map to show up on top of the screen. The toolbar title and bottom navigation bar still show the tab we were actually on (for example Contributions or Bookmarks), while the screen itself shows the Nearby map.

Once in this state, tapping the currently selected tab or switching between other tabs that were visited before Nearby does not clear the Nearby map. The only way to get the other tabs back is to tap the Nearby tab once and then switch away from it.

Root cause:

  • PR #7349 updated MainNavigationHelper (MainNavigationHelper.kt) to keep tab fragments alive using add(), hide(), and show() in performLoad() instead of replace(). FragmentManager hides inactive tabs by setting their root view to View.GONE while keeping them in the RESUMED state.
  • In fragment_nearby_parent.xml, coordinator_layout is the root view of NearbyParentFragment.
  • On returning to the app, MainActivity.onResume() triggers onResume() on all added fragments, including the hidden NearbyParentFragment.
  • NearbyParentFragment.onResume() unconditionally sets binding?.coordinatorLayout?.visibility = View.VISIBLE (line 961, added in PR #6187), overriding FragmentManager's View.GONE. Since NearbyParentFragment was added to R.id.fragmentContainer after the earlier tabs, it draws on top of them and hideActiveFragment() only hides activeFragment so Nearby stays visible until we navigate to Nearby and then leave it.
Steps to reproduce
  1. Open the app (when logged in, it opens on the Contributions tab).
  2. Tap on the Nearby tab.
  3. Switch back to the Contributions tab.
  4. Go to Home, switch to another app from Recents or lock and unlock the device.
  5. Come back to the Commons app.
  6. Observe that the toolbar and bottom navigation bar still show Contributions but the screen displays the Nearby map on top.
  7. Tap on the Contributions tab and observe that nothing happens and the Nearby map stays on screen.
  8. Tap on the Nearby tab once and then tap on Contributions. Now the Nearby map disappears and the Contributions screen is shown again.

Other tested flows that also reproduce the same issue (starting from a fresh app launch):

  • Contributions -> Explore -> Nearby -> Explore -> Home -> back to the app
  • Contributions -> Bookmarks -> Nearby -> Bookmarks -> Home -> back to the app
Expected behaviour

Coming back to the app should continue showing the tab you were on (Contributions, Explore, or Bookmarks). The hidden Nearby tab should stay hidden.

Actual behaviour

Coming back to the app shows the Nearby map covering the screen while the toolbar and bottom navigation bar remain on the last active tab. Tapping the active tab does not dismiss the Nearby map until you tap the Nearby tab once and then switch away from it.

Device name

OnePlus Nord 5

Android version

Android 16 (API 36)

Commons app version

6.9.0-debug-main (BetaDebug)

Device logs

No response

Screenshots
Contributions tab Explore tab Bookmarks tab
contributions explore bookmarks
Would you like to work on the issue?

Yes

Dominant language
Kotlin
Stars
1.2k
Forks
1.4k
Avg merge
1d 4h
Merged PRs (30d)
156

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from commons-app/apps-android-commons

All issues in commons-app/apps-android-commons

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.