Skip to content

fix: keep sync snackbar anchored correctly#20767

Merged
lukstbit merged 1 commit intoankidroid:mainfrom
criticalAY:deckpicker-search-snackbar-ux
Apr 19, 2026
Merged

fix: keep sync snackbar anchored correctly#20767
lukstbit merged 1 commit intoankidroid:mainfrom
criticalAY:deckpicker-search-snackbar-ux

Conversation

@criticalAY
Copy link
Copy Markdown
Contributor

@criticalAY criticalAY commented Apr 18, 2026

Purpose / Description

When the sync toolbar button is tapped while the search action view isexpanded, the keyboard is dismissed (focus leaves the search field) but the action view stays expanded, so the FAB remains hidden. The post-sync snackbar therefore shows unanchored, and the FAB is only restored when the user leaves and returns to the activity.

Also, when search is toggled while a snackbar is already showing, the snackbar's anchor becomes stale, either hovering above a hidden FAB (leaving a gap above the keyboard) or overlapping the FAB when it comes back.

Fixes

Approach

  1. onOptionsItemSelected(R.id.action_sync) : collapse toolbarSearchItem before starting the sync. That fires
    onMenuItemActionCollapse -> showFloatingActionButton(), so the FAB is back by the time the sync result snackbar appears.
  2. onMenuItemActionExpand: after hideFloatingActionButton(), null out activeSnackBar?.anchorView so a live snackbar drops to sit above the keyboard instead of hovering where the FAB used to be.
  3. onMenuItemActionCollapse: after showFloatingActionButton(), re-anchor activeSnackBar?.anchorView to fabMain so it sits above the FAB instead of being overlapped by it.

How Has This Been Tested?

Pixel 10

Learning (optional, can help others)

NA

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Apr 18, 2026
- onOptionsItemSelected(R.id.action_sync) : collapse toolbarSearchItem before starting the sync. That fires onMenuItemActionCollapse -> showFloatingActionButton(), so the FAB is back by the time the sync result snackbar appears.

- onMenuItemActionExpand: after hideFloatingActionButton(), null out activeSnackBar?.anchorView so a live snackbar drops to sit above the keyboard instead of hovering where the FAB used to be.

- onMenuItemActionCollapse: after showFloatingActionButton(), re-anchor activeSnackBar?.anchorView to fabMain so it sits above the FAB instead of being overlapped by it.
@criticalAY criticalAY force-pushed the deckpicker-search-snackbar-ux branch from 376f9f3 to c20df5f Compare April 18, 2026 17:38
@lukstbit lukstbit added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Apr 19, 2026
@lukstbit lukstbit added this pull request to the merge queue Apr 19, 2026
Merged via the queue into ankidroid:main with commit 538f16d Apr 19, 2026
15 checks passed
@github-actions github-actions Bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Apr 19, 2026
@github-actions github-actions Bot added this to the 2.24 release milestone Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAB/Add button not shown after sync click

3 participants