Skip to content

CMM-1160: Fix WP Media Library search overlap#22531

Merged
nbradbury merged 4 commits intotrunkfrom
issue/CMM-1160-wp-media-keyboard-search
Jan 27, 2026
Merged

CMM-1160: Fix WP Media Library search overlap#22531
nbradbury merged 4 commits intotrunkfrom
issue/CMM-1160-wp-media-keyboard-search

Conversation

@nbradbury
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury commented Jan 26, 2026

Description

Fixes CMM-1160

Previously, when creating a post and searching the WP Media Library with no results, the empty view is shown and the keyboard is hidden, but if the user tapped to continue typing, the keyboard would cover the empty view.

This PR fixes the problem by moving the empty view to the top so the keyboard won't cover it. I initially wasn't wild about this solution, but it turns out we already do this in the existing media search so it seemed like the right thing to do.

I also removed the image from the empty search results view as part of CMM-1037.

Testing instructions

Media picker search empty state:

  1. Create or edit a post
  2. Choose to add an image
  3. Select the WP Media Library source
  4. Search for something that returns no results and verify the empty view is shown
search.mp4

nbradbury and others added 2 commits January 26, 2026 13:43
When searching the WP Media Library with no results, the empty view is
shown and keyboard is hidden. If the user taps to continue typing, the
empty view is now hidden immediately to prevent the keyboard from
covering it. The empty view reappears after search completes.

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

dangermattic commented Jan 26, 2026

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

Generated by 🚫 Danger

@claude

This comment was marked as outdated.

@nbradbury nbradbury marked this pull request as ready for review January 26, 2026 19:05
@nbradbury nbradbury requested a review from adalpari January 26, 2026 19:05
@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Jan 26, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
FlavorJalapeno
Build TypeDebug
Versionpr22531-48dd1d3
Commit48dd1d3
Direct Downloadwordpress-prototype-build-pr22531-48dd1d3.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Jan 26, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
FlavorJalapeno
Build TypeDebug
Versionpr22531-48dd1d3
Commit48dd1d3
Direct Downloadjetpack-prototype-build-pr22531-48dd1d3.apk
Note: Google Login is not supported on these builds.

@nbradbury nbradbury changed the title CMM-1160: Hide empty view while typing in media picker search CMM-1160: Fix WP Media Library Search Jan 26, 2026
nbradbury and others added 2 commits January 26, 2026 14:29
Position the empty search results view at the top of the screen so it
remains visible when the soft keyboard appears. This is done by adding
vertical bias of 0 to the ConstraintLayout. Also removed the code that
was hiding the keyboard when empty results were shown.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@nbradbury
Copy link
Copy Markdown
Contributor Author

@claude

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 26, 2026

Claude finished @nbradbury's task in 51s —— View job


Code Review Complete

  • Read and analyze changed files
  • Review implementation approach
  • Check for potential issues
  • Provide comprehensive feedback

Review Summary

This PR effectively solves the keyboard overlay issue by repositioning the empty view to the top of the container and removing unnecessary image elements from the search empty state. The changes are clean, focused, and well-aligned with the existing codebase patterns.

Positive Observations

Clean removal of unused functionality - The PR removes image handling code (image, bottomImage, bottomImageDescription parameters) that's no longer needed, reducing complexity

Simple, effective layout solution - Using app:layout_constraintVertical_bias="0" to anchor the empty view to the top is elegant and prevents keyboard overlap

Consistent with existing patterns - As noted in the PR description, this approach matches the existing media search behavior

Proper cleanup - Removed unused import (ActivityUtils) that's no longer needed after removing keyboard-hiding code

Maintains separation of concerns - ViewModel changes are kept separate from Fragment UI logic changes

Minor Observations

Code Structure

The changes maintain good architectural patterns:

  • ViewModel handles the data model (PhotoListUiModel.Empty parameters)
  • Fragment handles UI presentation (setupPhotoList, applyOrHide)
  • Layout XML defines the visual positioning

Testing Consideration

The PR includes clear testing instructions and a demo video. Consider verifying these scenarios:

  1. Empty state appears at top when no results (✓ covered in video)
  2. Keyboard doesn't cover empty view when typing continues (✓ covered in video)
  3. Empty view behavior in portrait vs landscape orientations
  4. Empty view with different content lengths (long titles/subtitles)

Edge Cases to Verify

While the implementation looks solid, ensure these scenarios work correctly:

  1. Rotation handling - Empty view maintains top position after device rotation
  2. Different screen sizes - Top-anchored view works well on both small phones and tablets
  3. Accessibility - Screen readers properly announce the empty view when it appears at the top

No Issues Found

No bugs, security issues, performance problems, or code quality concerns identified. The implementation is straightforward and appropriate for the problem being solved.


Overall Assessment: ✅ Approved - Well-executed fix with clean code removal and proper architectural separation.


@nbradbury nbradbury changed the title CMM-1160: Fix WP Media Library Search CMM-1160: Fix WP Media Library search overlap Jan 26, 2026
Copy link
Copy Markdown
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.

Fair enough. LGTM!

@nbradbury nbradbury merged commit 14455b1 into trunk Jan 27, 2026
26 checks passed
@nbradbury nbradbury deleted the issue/CMM-1160-wp-media-keyboard-search branch January 27, 2026 12:38
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.

4 participants