Skip to content

Hide navigation menus FAB on scroll#22575

Merged
nbradbury merged 24 commits intotrunkfrom
issue/menus-fab
Feb 9, 2026
Merged

Hide navigation menus FAB on scroll#22575
nbradbury merged 24 commits intotrunkfrom
issue/menus-fab

Conversation

@nbradbury
Copy link
Contributor

@nbradbury nbradbury commented Feb 7, 2026

Description

Partially addresses CMM-1166.

Hides the floating action button when scrolling down and shows it when scrolling up in the navigation menus screens. This was necessary because the FAB could obscure the "Edit items" button in the menu list and the move up/down icons in the menu item list.

The FAB uses AnimatedVisibility with slide transitions for a smooth show/hide effect. Scroll direction is detected via snapshotFlow on the LazyListState in both MenuListScreen and MenuItemListScreen.

Testing instructions

FAB hides on scroll down:

  1. Open Navigation Menus from a site with multiple menus
  2. Scroll the menu list downward
  • Verify the FAB slides out of view
  1. Scroll back up
  • Verify the FAB slides back into view

FAB behavior on menu item list:

  1. Tap a menu to open its items list
  2. Scroll the menu items list downward
  • Verify the FAB slides out of view
  1. Scroll back up
  • Verify the FAB slides back into view

FAB resets on navigation:

  1. Scroll down on the menu list so the FAB is hidden
  2. Tap a menu to navigate to the menu items screen
  • Verify the FAB is visible again on the new screen
fab.mp4

nbradbury and others added 22 commits February 5, 2026 06:12
Implements infinite scroll pagination for menu list, menu item list, and
linkable items dropdown with page size of 20. Shows loading spinner when
fetching more items.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix pagination not triggering after second page by properly tracking
  state changes in LaunchedEffect keys
- Remove inaccurate menu item count from menu list
- Remove unused fetchAllMenuItems function
- Move Edit Items button to end of menu card, centered vertically
- Fix detekt warnings: swallowed exceptions, unused imports, complexity
- Extract MenuItemListContent and sibling helper functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ExposedDropdownMenu doesn't support LazyColumn (SubcomposeLayout
intrinsic measurement issue), causing crashes when opening the dropdown.
This replaces it with a ModalBottomSheet which properly supports
pagination with LazyColumn.

Also restores PAGE_SIZE to 20 (was 5 for testing).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This resource was left over after removing the menu item count feature.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract duplicate type selection label logic to helper function
- Simplify parseErrorMessage by consolidating redundant cases
- Consolidate findPreviousSiblingIndex/findNextSiblingIndex into single function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevents race conditions when multiple pagination requests occur in
rapid succession. Each pagination function now uses a mutex to ensure
atomic read-check-update operations, preventing duplicate items or
incorrect pagination state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ensure canLoadMore remains true when pagination fails, allowing users
to retry after transient errors (network issues, timeouts, etc.).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Prevents stale data from overwriting state when user rapidly switches
between menu item types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Support all 22 protocols from wp_allowed_protocols(): http, https, ftp,
ftps, mailto, news, irc, irc6, ircs, gopher, nntp, feed, telnet, mms,
rtsp, sms, svn, tel, fax, xmpp, webcal, urn. Also adds support for
anchor links (#section) and protocol-relative URLs (//).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Derive offset from UI state instead of cache variables to avoid race
  conditions between initial load and pagination
- Set canLoadMore=true on initial load errors to allow retry

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pre-compute parent-to-children mapping to reduce child lookup from O(n)
to O(1) per item, improving overall complexity from O(n²) to O(n log n).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use when expression to reduce return statements from 4 to 2.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use async/await to fetch menus and locations concurrently, reducing
initial load time.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-Android into issue/menus-parallel-requests

Conflicts:
	WordPress/src/main/java/org/wordpress/android/ui/navmenus/NavMenusViewModel.kt
Wraps the navigation menus FAB in AnimatedVisibility with slide
transitions, and uses snapshotFlow to detect scroll direction in
both MenuListScreen and MenuItemListScreen to toggle visibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dangermattic
Copy link
Collaborator

dangermattic commented Feb 7, 2026

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@nbradbury nbradbury added the Menus label Feb 7, 2026
Moves the scroll-direction FAB visibility logic and load-more
pagination logic into reusable ObserveScrollDirectionForFab and
ObserveLoadMore composables, used by both MenuListScreen and
MenuItemListScreen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 7, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
FlavorJalapeno
Build TypeDebug
Versionpr22575-95fadbe
Build Number1484
Application IDorg.wordpress.android.prealpha
Commit95fadbe
Installation URL5irtqmik7cclo
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 7, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
FlavorJalapeno
Build TypeDebug
Versionpr22575-95fadbe
Build Number1484
Application IDcom.jetpack.android.prealpha
Commit95fadbe
Installation URL6v0njuksopbm8
Note: Google Login is not supported on these builds.

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 0% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.26%. Comparing base (bcdb13d) to head (95fadbe).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...i/navmenus/screens/ObserveScrollDirectionForFab.kt 0.00% 33 Missing ⚠️
.../wordpress/android/ui/navmenus/NavMenusActivity.kt 0.00% 10 Missing ⚠️
.../android/ui/navmenus/screens/MenuItemListScreen.kt 0.00% 9 Missing ⚠️
...ress/android/ui/navmenus/screens/MenuListScreen.kt 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22575      +/-   ##
==========================================
- Coverage   38.27%   38.26%   -0.02%     
==========================================
  Files        2237     2238       +1     
  Lines      111503   111537      +34     
  Branches    15581    15585       +4     
==========================================
  Hits        42680    42680              
- Misses      65282    65316      +34     
  Partials     3541     3541              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

@nbradbury nbradbury requested a review from adalpari February 9, 2026 13:02
@nbradbury nbradbury marked this pull request as ready for review February 9, 2026 13:02
Copy link
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

LGTM!

@nbradbury nbradbury merged commit 9f771fd into trunk Feb 9, 2026
32 of 34 checks passed
@nbradbury nbradbury deleted the issue/menus-fab branch February 9, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants