Skip to content

nmc/5808-web-android-files-search-is-not-showing-all-results-2 - #501

Merged
memurats merged 1 commit into
stable33from
nmc/5808-web-android-files-search-is-not-showing-all-results-2
Sep 9, 2026
Merged

nmc/5808-web-android-files-search-is-not-showing-all-results-2#501
memurats merged 1 commit into
stable33from
nmc/5808-web-android-files-search-is-not-showing-all-results-2

Conversation

@suet-kei-chan

Copy link
Copy Markdown
Contributor

The bug: on Android, the search dialog's keyboard is always up (input autofocuses), which only shrinks the visual viewport — not the layout viewport that vh/dvh/% size against. So the dialog kept its full height while the keyboard covered the bottom ~45% of the screen, stranding the last results and "Load more results" with nothing to scroll to them.

Scope: applies to every modal (rename, share, file picker, tag), not just search — same root cause everywhere. Desktop is unchanged.

Verified: measured against the live dev instance across 9 viewport sizes (320×568–1440×900, portrait/landscape); not yet confirmed on a physical Android device.

…is open

On Android Chrome the unified search dialog autofocuses its input on open,
so the on-screen keyboard is always up while searching. The keyboard only
shrinks the visual viewport; the layout viewport is untouched, and per the
CSS Values 4 spec the viewport-percentage units (vh, dvh, svh, lvh) are
explicitly allowed to ignore it, which Chrome on Android does. The dialog
was therefore laid out at full height while the keyboard covered roughly
the bottom 45% of the screen, stranding the last results and the "Load
more results" button behind it with nothing left to scroll.

A prior attempt (143915d) swapped vh for dvh, but dvh does not track the
keyboard either, so it could not fix this. It also set a --dialog-height
custom property that no version of @nextcloud/vue or Nextcloud core reads.

window.visualViewport is the only source of truth for what is actually
visible, so add src/js/viewportmetrics.js to mirror it onto the document
element as --nmc-viewport-height, --nmc-viewport-offset-top, and a coarse
[data-nmc-viewport] tier (roomy/tight/minimal) for layout that cannot be
expressed as a length alone. Wire it into the build (webpack.config.cjs)
and load it on every page (BeforeTemplateRenderedListener.php), alongside
the existing theme scripts.

Bind every modal to these values in css/layouts/modal.scss instead of just
the search dialog, since the same keyboard-vs-viewport mismatch affects
any dialog with a text input (rename, share, file picker, tag). The tier
overrides are expressed as inherited custom properties
(--nmc-modal-inset/-padding/-margin, defined in css/nmcdefault.scss) so
they never have to out-specify the base modal-container rules.

In css/components/search.scss:
- Fix .modal-container__content, which NcModal ships as
  flex: 0 1 auto; min-height: 52px. Squeezing the container collapsed it
  to 52px, and .dialog's height: 100% then resolved against that,
  shrinking the results list to zero height.
- Make .unified-search-modal__results an explicit shrinkable scroller
  and override core's rule that disables its scrolling under 400px of
  viewport height, which removed the only way to reach "Load more
  results" exactly where room is tightest.
- Add the tight/minimal tier rules that reclaim fixed chrome (dialog
  heading hidden accessibly, denser rows, filters hidden only in the
  landscape+keyboard case) so results stay usable as the visible area
  shrinks.
- Remove the dead --dialog-height declaration.

Verified against the live dev instance across 9 viewport sizes (320x568
through 1440x900, portrait and landscape) by driving the real bundle with
a simulated visualViewport resize: the modal now ends exactly at the
simulated keyboard line and "Load more results" stays reachable and
functional (pagination confirmed 5 -> 10 -> 15 results) in every case.
Desktop layout is unchanged (--nmc-viewport-height resolves to the window
height there, so min() still resolves to the existing 80dvh cap). Other
dialogs (move-or-copy, new folder) were spot-checked and unaffected on
both mobile and desktop.
@suet-kei-chan suet-kei-chan self-assigned this Sep 9, 2026
@memurats
memurats merged commit 0e6d720 into stable33 Sep 9, 2026
4 of 6 checks passed
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.

3 participants