Skip to content

Fix: Snackbar overlapping bottom navigation bar on Explore screen#6742

Open
Shoaibkhalid65 wants to merge 3 commits intocommons-app:mainfrom
Shoaibkhalid65:fix/snackbar-overlapping-bottom-navigation
Open

Fix: Snackbar overlapping bottom navigation bar on Explore screen#6742
Shoaibkhalid65 wants to merge 3 commits intocommons-app:mainfrom
Shoaibkhalid65:fix/snackbar-overlapping-bottom-navigation

Conversation

@Shoaibkhalid65
Copy link
Contributor

Fixes #6741

Problem

On the Explore screen, when an error occurs while loading images, the Snackbar was appearing at the very bottom of the screen and overlapping the bottom navigation bar, making it partially hidden.

Root Cause

showShortSnackbar in ViewUtil had no anchor view parameter, causing the Snackbar to render at the bottom of the window, covering the navigation bar.

Fix

  • Added optional anchorView parameter to ViewUtil.showShortSnackbar()
  • In BasePagingFragment.showSnackbar(), passed R.id.fragment_main_nav_tab_layout as the anchor view so the Snackbar appears above the bottom navigation bar

Screenshots

Before:
unfixed_snackbar_align_img

unfixed_snackbar_alig_vid.mp4

After:
fixed_snackbar_align_img

fixed_snackbar_align_vid.mp4

Tested on: Samsung a07 | Android 16

@rovertrack
Copy link
Contributor

rovertrack commented Mar 17, 2026

Review by GSoC applicant

reproducing the original issue :

az_recorder_20260318_031718.mp4

the snackbar indeed occurs from the nav bottom bar

after applying the changes by @Shoaibkhalid65 :

az_recorder_20260318_032545.mp4

the original issue has been solved as addressed in this pr ✅

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me.
Thanks @rovertrack for the review!

@github-actions
Copy link

✅ Generated APK variants!

override fun showSnackbar() {
ViewUtil.showShortSnackbar(binding.paginatedSearchResultsList, errorTextId)
val anchorView= activity?.findViewById<View>(R.id.fragment_main_nav_tab_layout)
ViewUtil.showShortSnackbar(binding.paginatedSearchResultsList, errorTextId,anchorView)
Copy link
Collaborator

@neeldoshii neeldoshii Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for contributing @Shoaibkhalid65. No issues with the current approach, but how about using Coordinator layout at the xml file i.e in main.xml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @neeldoshii, I tried your suggestion of using CoordinatorLayout. I first tried replacing the RelativeLayout in main.xml but it caused all fragment content to shift behind the bottom navigation bar and the Snackbar stopped showing entirely. I also tried replacing the RelativeLayout in fragment_explore_map.xml but the TabLayout started overlapping the content below it.
I think the issue is that the existing layouts rely on RelativeLayout's layout_above and layout_below constraints for positioning, and switching to CoordinatorLayout without restructuring the full layout hierarchy breaks those constraints.
Could you point me to the exact file or layout you had in mind? I want to make sure I implement this the right way rather than guessing. Happy to make whatever changes you suggest.

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.

[Bug]: Snackbar overlaps bottom navigation bar on Explore screen

4 participants