[PR #4427] [MERGED] Mobile: adjust modals height to visual viewport #39809

Closed
opened 2026-04-23 12:44:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/4427
Author: @andrew--r
Created: 2/21/2025
Status: Merged
Merged: 2/22/2025
Merged by: @matt-fidd

Base: masterHead: master


📝 Commits (5)

  • 851c47f Mobile: adapt autocomplete modals to visual viewport
  • 27dcea9 Fix modal max-height, animate height changes
  • 86fbec6 Update VRT
  • b56ffa7 Update max-height to be 90% of visual viewport
  • 7c66f1b Update VRT

📊 Changes

6 files changed (+90 additions, -67 deletions)

View changed files

📝 packages/desktop-client/src/components/common/Modal.tsx (+72 -63)
📝 packages/desktop-client/src/components/modals/AccountAutocompleteModal.tsx (+3 -1)
📝 packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx (+3 -1)
📝 packages/desktop-client/src/components/modals/EditFieldModal.tsx (+3 -1)
📝 packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx (+3 -1)
upcoming-release-notes/4427.md (+6 -0)

📄 Description

Motivation

Currently, keyboard on mobile (specifically iOS) overlaps modal's content, which is not great in some cases:

  • longs lists (e.g. transaction category/payee modals) are not fully visible and it's not possible to choose one of the last options without additional actions (hiding the keyboard, searching by the option text)
  • submit buttons are sometimes hidden under the keyboard if the form is long enough (e.g. category note form), which also forces a user to hide the keyboard before submitting changes

https://github.com/user-attachments/assets/59b43a8d-bed1-43c7-bd3d-a65e4838f6c8

Solution

React Aria exposes a CSS custom property with a height of the visual viewport:

The --visual-viewport-height CSS custom property will be set on the ModalOverlay, which you can use to set the height to account for the virtual keyboard on mobile. (source)

I slightly changed the layout of the <Modal>. Now there are two base layers:

  • ReactAriaModalOverlay that expands to the whole viewport (not the visual one) and provides a backdrop
  • let's call it "positioning container" inside the overlay that takes the height of the visual viewport and positions the modal relative to it

Overlay and positioning container should be separate to keep the overlay stable when keyboard closes, otherwise you'll see flicker (while keyboard is closing, the part of the screen that it occupied will not be covered by backdrop).

I also tweaked the height of some existing modals to be relative to the visual viewport.

https://github.com/user-attachments/assets/ea7ca718-14b9-4265-adfd-9ab9c4af9479

Note

Would be nice to get someone to test this on Android, as I don't have an Android device to confirm the behaviour there. Shouldn't break anything though

Fixes https://github.com/actualbudget/actual/issues/3939


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/4427 **Author:** [@andrew--r](https://github.com/andrew--r) **Created:** 2/21/2025 **Status:** ✅ Merged **Merged:** 2/22/2025 **Merged by:** [@matt-fidd](https://github.com/matt-fidd) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (5) - [`851c47f`](https://github.com/actualbudget/actual/commit/851c47f6fb27a3d84f7346a4c4f301ea9ac89106) Mobile: adapt autocomplete modals to visual viewport - [`27dcea9`](https://github.com/actualbudget/actual/commit/27dcea9f488e6dc6ea6ab803bb4e3b32752e383d) Fix modal max-height, animate height changes - [`86fbec6`](https://github.com/actualbudget/actual/commit/86fbec633678ffbca26d0494b905e12f853950af) Update VRT - [`b56ffa7`](https://github.com/actualbudget/actual/commit/b56ffa7fb1e0625822aa12f42e4088193364db8a) Update max-height to be 90% of visual viewport - [`7c66f1b`](https://github.com/actualbudget/actual/commit/7c66f1bee65d1a74089bab6968ff34c3f09a96b9) Update VRT ### 📊 Changes **6 files changed** (+90 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/common/Modal.tsx` (+72 -63) 📝 `packages/desktop-client/src/components/modals/AccountAutocompleteModal.tsx` (+3 -1) 📝 `packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx` (+3 -1) 📝 `packages/desktop-client/src/components/modals/EditFieldModal.tsx` (+3 -1) 📝 `packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx` (+3 -1) ➕ `upcoming-release-notes/4427.md` (+6 -0) </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes --> ## Motivation Currently, keyboard on mobile (specifically iOS) overlaps modal's content, which is not great in some cases: - longs lists (e.g. transaction category/payee modals) are not fully visible and it's not possible to choose one of the last options without additional actions (hiding the keyboard, searching by the option text) - submit buttons are sometimes hidden under the keyboard if the form is long enough (e.g. category note form), which also forces a user to hide the keyboard before submitting changes https://github.com/user-attachments/assets/59b43a8d-bed1-43c7-bd3d-a65e4838f6c8 ## Solution React Aria exposes a CSS custom property with a height of the [visual viewport](https://developer.mozilla.org/en-US/docs/Glossary/Visual_Viewport): > The `--visual-viewport-height` CSS custom property will be set on the ModalOverlay, which you can use to set the height to account for the virtual keyboard on mobile. ([source](https://react-spectrum.adobe.com/react-aria/Modal.html)) I slightly changed the layout of the `<Modal>`. Now there are two base layers: - `ReactAriaModalOverlay` that expands to the whole viewport (not the visual one) and provides a backdrop - let's call it "positioning container" inside the overlay that takes the height of the visual viewport and positions the modal relative to it Overlay and positioning container should be separate to keep the overlay stable when keyboard closes, otherwise you'll see flicker (while keyboard is closing, the part of the screen that it occupied will not be covered by backdrop). I also tweaked the height of some existing modals to be relative to the visual viewport. https://github.com/user-attachments/assets/ea7ca718-14b9-4265-adfd-9ab9c4af9479 > [!NOTE] > Would be nice to get someone to test this on Android, as I don't have an Android device to confirm the behaviour there. Shouldn't break anything though Fixes https://github.com/actualbudget/actual/issues/3939 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 12:44:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#39809