App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Android - Spend - "Apply" button is overlapped by keyboard in exposed filter.

Open applause-bot[bot] opened this issue 1 month ago • 136 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.21-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/104671 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Motorola MotoG60 / Android 12 (Hybrid app) App Component: Search

Action Performed:

  1. Open the Expensify app.
  2. Navigate to "Spend" > "Expenses"
  3. Tap on "FIlters" icon > "Withdrawal ID"
  4. Enter any ID > "Confirm" > "Apply Filters"
  5. Tap on exposed filter.
  6. Tap on text input to open keyboard.
  7. Note that "Apply" button is overlapped by keyboard and user can´t scroll down to it.

Expected Result:

"Apply" button should be completelly visible while editing withdrawal ID via exposed filter.

Actual Result:

"Apply" button is overlapped by keyboard while editing withdrawal ID via exposed filter and user is unable to scroll down to it.

Workaround:

Unknown

Platforms:

  • [x] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/d8f87a9e-e6af-419c-b4df-113449e0d48e

View all open jobs on GitHub

Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7297588

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mukhrr

applause-bot[bot] avatar Oct 27 '26 15:10 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/5641d273a629159887b0e9f777cf54c0e74e54c456366f0b042cdebb6b14df5a

applause-bot[bot] avatar Oct 27 '26 15:10 applause-bot[bot]

Proposal

What is the root cause of that problem?

On small screens, every text filter chip (Withdrawal ID, Description, Title, Report ID, and others) opens TextFilterPopup inside a bottom-docked FilterPopupButton sheet. Two problems stack up:

  1. Keyboard room comes only from the modal-level avoidKeyboard. That flag wraps the sheet in a padding KeyboardAvoidingView (ReanimatedModal/index.tsx:244). On this Android device it adds too little padding, or none, so the keyboard covers "Apply". The selection-list sheets stopped using avoidKeyboard for inputs for this reason. They pad the content with useReanimatedKeyboardAnimation instead (useSelectionListPopoverLayout.ts:90-105).
  2. There is no scroll fallback. BasePopup is a plain View with the input and then ActionButtons. FilterPopupButton also turns off the modal's only ScrollView wrapper (line 160). Once "Apply" is covered, you can't scroll to it.

What changes do you think we should make in order to solve the problem?

In FilterPopupButton, on small screens, follow the useSelectionListPopoverLayout pattern:

  • Stop passing avoidKeyboard to PopoverWithMeasuredContent.
  • Make the content wrapper (line 163) an Animated.View. Set its paddingBottom to max(safeAreaBottom, -keyboardHeight) from useReanimatedKeyboardAnimation. The sheet then rises with the keyboard and keeps "Apply" visible.

This fixes all text filter chips at once, since they share this wrapper.

What alternative solutions did you explore? (Optional)

  • Wrap BasePopup's children and ActionButtons in a ScrollView with keyboardShouldPersistTaps="handled". This makes "Apply" reachable but doesn't keep it in view. It is a good safety net to pair with the main fix.
  • Set automaticOffset on the shared KeyboardAvoidingView in ReanimatedModal. This changes every modal that uses avoidKeyboard, so it needs much broader QA.
Investigation notes
  • Confidence: medium. The component chain and the missing scroll fallback are confirmed in code. The native reason the padding falls short is not confirmed. One likely cause is a mismatch between the Dialog window height and the screen height (for example, the 3-button nav bar on HybridApp). This run could only test on web, so it couldn't reproduce the Android keyboard. Check the fix on a physical Android device with 3-button navigation.
  • avoidKeyboard reaches Android intact: PopoverWithMeasuredContent → Popover/index.native (bottom-docked) → Modal/index.android → BaseModal → ReanimatedModal. The avoidKeyboard={false} in Modal/index.tsx applies only on web.
  • This is not a regression from Add the Withdrawal ID custom column to expense report searches. That PR only changes columns and sorting, and the issue also reproduces in production. Recent commits to FilterPopupButton don't touch keyboard handling.
  • MerchantFilterPopup uses the same layout, so the Merchant chip is likely affected too.

Possibly related: Android & iOS - Spend - Unable to scroll down Describe your search page in landscape, "Describe your search" box hidden behind keyboard when put cursor on it in landscape


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105145) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Oct 27 '26 15:10 MelvinBot

VERDICT: POST ROOT_CAUSE_ONELINER: BasePopup renders its content (TextInput + Apply button) in a non-scrollable View, and Android's KeyboardAvoidingView inside a React Native Modal window does not reliably adjust the popup height when the keyboard appears, so the Apply button is hidden beneath the keyboard with no way to scroll to it. PROPOSAL_TYPE: FIRST AUTOPOST_SAFE: YES

j3ffffff avatar Oct 27 '26 15:10 j3ffffff

Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)

melvin-bot[bot] avatar Oct 27 '26 15:10 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022115102803454012561

melvin-bot[bot] avatar Oct 27 '26 15:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Android (hybrid app/mobile screens), when opening an exposed filter popover (such as Withdrawal ID, Description, or Report ID) in Spend > Expenses and focusing the text input to display the keyboard, the "Apply" button is overlapped by the soft keyboard, and the user is unable to scroll down to reach it.

What is the root cause of that problem?

In src/components/Search/FilterDropdowns/FilterPopupButton.tsx (lines 140–165) and src/components/Search/FilterDropdowns/BasePopup.tsx:

  1. On narrow screens, filter popups dock at the bottom of the screen inside PopoverWithMeasuredContent.
  2. Although FilterPopupButton passes avoidKeyboard to PopoverWithMeasuredContent, on Android dialog windows (especially with 3-button system navigation), KeyboardAvoidingView does not reliably shrink the modal window content, leaving the popover positioned under the soft keyboard.
  3. Furthermore, BasePopup.tsx renders its input children and <ActionButtons /> inside a plain, unscrollable <View style={[styles.pv4, style]}>, and FilterPopupButton.tsx sets shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false}. When the keyboard overlaps the bottom of the popup, there is no scrollable container, trapping the "Apply" button completely off-screen.

What changes do you think we should make in order to solve the problem?

Apply the established NewDot pattern for keyboard-safe bottom sheets (minimal blast radius):

  1. In src/components/Search/FilterDropdowns/FilterPopupButton.tsx: Adopt useReanimatedKeyboardAnimation (identical to useSelectionListPopoverLayout.ts):
    • Replace the static inner content wrapper (<View style={[containerStyles, bottomSafeAreaPaddingStyle]}>) with an Animated.View.
    • Apply animated bottom padding derived from useReanimatedKeyboardAnimation() to lift the popup above the keyboard:
      const {keyboardHeight} = useReanimatedKeyboardAnimation();
      const animatedPaddingStyle = useAnimatedStyle(() => ({
          paddingBottom: Math.max(bottomSafeAreaPadding, -keyboardHeight.get()),
      }));
      
  2. In src/components/Search/FilterDropdowns/BasePopup.tsx: Wrap the container content in a ScrollView with keyboardShouldPersistTaps="handled" on small screen widths (isSmallScreenWidth), ensuring that even on smaller screens or landscape mode, the user can always scroll down to see and tap "Apply".

Why this solution is superior to MelvinBot's: MelvinBot suggests removing avoidKeyboard entirely and only applying animated padding. However, without pairing the animated keyboard adjustment with a scrollable container in BasePopup.tsx, devices with high display scaling or small viewports will still clip the "Apply" button when both the system keyboard and suggestions bar are active. Adding the ScrollView fallback in BasePopup ensures 100% reachability across all Android devices and screen densities.

What alternative solutions did you explore? (Optional)

  • Modifying global ReanimatedModal KeyboardAvoidingView: Rejected because altering global modal behavior introduces a massive blast radius across all modals in the app.
  • Dismissing the keyboard on text change: Rejected because dismissing the keyboard interrupts user typing flow.

What automated tests can you add to prevent this from re-occurring?

Add unit tests in tests/unit/FilterPopupButtonTest.tsx / BasePopupTest.tsx verifying:

it('should render content with keyboard animated padding on small screens', () => {
    const {getByTestId} = render(<FilterPopupButton {...defaultProps} isSmallScreenWidth />);
    expect(getByTestId('filter-popup-container')).toBeTruthy();
});

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83

camesenin avatar Oct 27 '26 15:10 camesenin

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 27 '26 15:10 melvin-bot[bot]

Proposal: [$175] Android - Spend - "Apply" button is overlapped by keyboard in exposed filter (#105145)

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Android, when opening an exposed search filter chip (e.g. "Withdrawal ID", "Description", "Merchant") on the Spend page and tapping the text input, the soft keyboard overlaps and obscures the bottom "Apply" button, and the user cannot scroll down to tap it.


What is the root cause of that problem?

Two structural issues compound to cause this on Android:

  1. Unreliable Modal-Level avoidKeyboard on Bottom-Docked Popovers: In src/components/Search/FilterDropdowns/FilterPopupButton.tsx:141, PopoverWithMeasuredContent passes avoidKeyboard={true}. On small screens (isSmallScreenWidth), the popover delegates to a bottom-docked ReanimatedModal. React Native's KeyboardAvoidingView inside bottom-docked modals fails to calculate the correct translation on edge-to-edge Android devices (particularly with 3-button navigation bars and custom soft-input modes). This exact flaw was previously identified and solved for SelectionList popovers in src/hooks/useSelectionListPopoverLayout.ts:90-105.
  2. Missing Scroll Container in BasePopup: In src/components/Search/FilterDropdowns/BasePopup.tsx:47-69, the content ({children}) and the bottom <ActionButtons /> are rendered inside a static, non-scrollable <View style={[styles.pv4, style]}>. Because FilterPopupButton also sets shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false} (line 160), there is no scroll fallback if the viewport height above the keyboard is smaller than the popup height.

What changes do you think we should make in order to solve the problem?

We should follow the established, proven pattern from useSelectionListPopoverLayout.ts:

1. In src/components/Search/FilterDropdowns/FilterPopupButton.tsx:

  • On narrow screens (isSmallScreenWidth), disable avoidKeyboard (avoidKeyboard={!isSmallScreenWidth}).
  • Use useReanimatedKeyboardAnimation and useAnimatedStyle to dynamically lift the bottom-docked sheet above the soft keyboard:
    const {height: keyboardOffset} = useReanimatedKeyboardAnimation();
    const keyboardPaddingStyle = useAnimatedStyle(() => ({
        paddingBottom: isSmallScreenWidth ? Math.max(bottomSafeAreaPadding, -keyboardOffset.get()) : 0,
    }));
    
  • Wrap the popover content in an Animated.View applying [containerStyles, bottomSafeAreaPaddingStyle, keyboardPaddingStyle].

2. In src/components/Search/FilterDropdowns/BasePopup.tsx:

  • Wrap the inner content area ({children}) in a ScrollView with keyboardShouldPersistTaps="handled" and bounces={false} while keeping <ActionButtons /> pinned at the bottom, or wrap the full body so that small devices in landscape orientation can always scroll to reveal the "Apply" CTA.

Surgical TypeScript Diff

--- a/src/components/Search/FilterDropdowns/FilterPopupButton.tsx
+++ b/src/components/Search/FilterDropdowns/FilterPopupButton.tsx
@@ -10,6 +10,8 @@ import useThemeStyles from '@hooks/useThemeStyles';
 import useWindowDimensions from '@hooks/useWindowDimensions';
+import useReanimatedKeyboardAnimation from '@hooks/useReanimatedKeyboardAnimation';
+import Animated, {useAnimatedStyle} from 'react-native-reanimated';
 import {isSmallScreenWidth as isSmallScreenWidthUtils} from '@libs/DeviceCapabilities';
 import * as StyleUtils from '@styles/StyleUtils';
 import CONST from '@src/CONST';
@@ -87,6 +89,12 @@ function FilterPopupButton({
     const {isSmallScreenWidth, isInLandscapeMode} = useResponsiveLayout();
     const [popoverAnchorAlignment, setPopoverAnchorAlignment] = useState<AnchorAlignment>(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT);
     const [hasEverExpanded, setHasEverExpanded] = useState(false);
+    
+    const {height: keyboardOffset} = useReanimatedKeyboardAnimation();
+    const animatedKeyboardPaddingStyle = useAnimatedStyle(() => ({
+        paddingBottom: isSmallScreenWidth ? Math.max(bottomSafeAreaPadding, -keyboardOffset.get()) : 0,
+    }));
 
     const onLayout = useCallback(
         (event: LayoutChangeEvent) => {
@@ -138,7 +146,7 @@ function FilterPopupButton({
             {isFocused && hasEverExpanded && (
                 <PopoverWithMeasuredContent
                     anchorRef={triggerRef}
-                    avoidKeyboard
+                    avoidKeyboard={!isSmallScreenWidth}
                     isVisible={isOverlayVisible}
                     onClose={toggleOverlay}
                     anchorPosition={popoverTriggerPosition}
@@ -160,7 +168,7 @@ function FilterPopupButton({
                     shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false}
                     enableEdgeToEdgeBottomSafeAreaPadding
                 >
-                    <View style={[containerStyles, bottomSafeAreaPaddingStyle]}>{popoverContent}</View>
+                    <Animated.View style={[containerStyles, isSmallScreenWidth ? animatedKeyboardPaddingStyle : bottomSafeAreaPaddingStyle]}>{popoverContent}</Animated.View>
                 </PopoverWithMeasuredContent>
             )}
         </View>
--- a/src/components/Search/FilterDropdowns/BasePopup.tsx
+++ b/src/components/Search/FilterDropdowns/BasePopup.tsx
@@ -9,6 +9,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
 import type {StyleProp, ViewStyle} from 'react-native';
 
 import React from 'react';
-import {View} from 'react-native';
+import {ScrollView, View} from 'react-native';
 
 import ActionButtons from './ActionButtons';
@@ -55,7 +56,9 @@ function BasePopup({
             ) : (
                 shouldDisplayLabel && <Text style={[styles.textLabel, styles.textSupporting, styles.ph5, styles.pv1, styles.mb2]}>{label}</Text>
             )}
-            {children}
+            <ScrollView keyboardShouldPersistTaps="handled" bounces={false} style={styles.flexShrink1}>
+                {children}
+            </ScrollView>
             {shouldShowActionButtons && (
                 <ActionButtons
                     containerStyle={[styles.flexRow, styles.gap2, styles.ph5, styles.mt2]}

What alternative solutions did you explore? (Optional)

  1. Modifying global ReanimatedModal KeyboardAvoidingView: Rejected because altering the global modal keyboard behavior carries an unacceptable blast radius across all modals and wizards in the application.
  2. Competing proposals using keyboardHeight property: Note that useReanimatedKeyboardAnimation returns {height: SharedValue<number>}, not keyboardHeight. Using keyboardHeight returns undefined at runtime. Our solution uses the verified {height: keyboardOffset} signature matching useSelectionListPopoverLayout.ts:90.

Automated Tests

Add a test in tests/unit/FilterPopupButtonTest.tsx verifying that avoidKeyboard={false} on narrow screens when bottom-docked animated padding is active, and confirming Animated.View receives animated style props.

apoorv-xs avatar Oct 27 '26 18:10 apoorv-xs

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Android native, when opening an exposed filter popup in Spend (such as the Merchant, Description, Category, or Title filter popup) and focusing the text input, the soft keyboard overlaps the bottom "Apply" button instead of pushing the popup cleanly above the keyboard.

What is the root cause of that problem?

  1. The exposed filter popups (TextFilterPopup, etc.) are rendered inside <PopoverWithMeasuredContent> via src/components/Search/FilterDropdowns/FilterPopupButton.tsx (lines 84–99):

    <PopoverWithMeasuredContent
        shouldHandleNavigationBack
        anchorRef={buttonRef}
        anchorPosition={popoverAnchorPosition}
        anchorAlignment={anchorAlignment}
        onClose={closePopup}
        isVisible={isPopupVisible}
        ...
    
  2. Across the entire codebase, <KeyboardProvider> (src/components/KeyboardProvider/index.tsx lines 7–9), <BaseModal> (src/components/Modal/BaseModal.tsx lines 117–118), and <ReanimatedModal> (src/components/Modal/ReanimatedModal/index.tsx lines 55–56) all default to:

    statusBarTranslucent = true,
    navigationBarTranslucent = true,
    

    However, src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx (line 58) is the only modal wrapper in the codebase that still defaults statusBarTranslucent to false:

    statusBarTranslucent = false,
    

    and passes statusBarTranslucent={statusBarTranslucent} down to <Popover> (line 237) -> <Modal> (BaseModal.tsx line 322) -> <ReanimatedModal> -> React Native's <Modal>.

  3. Why statusBarTranslucent = false (combined with navigationBarTranslucent = true) causes the exact keyboard overlap on Android:

    • In React Native's Android ReactModalHostView.kt, navigationBarTranslucent = true enables edge-to-edge on the modal Dialog window, while statusBarTranslucent = false sets fitsSystemWindows = true on the modal's contentView (FrameLayout).
    • Because fitsSystemWindows = true is set on contentView, Android insets the modal's root view group from the top by statusBarHeight (e.g. 40dp / 80px on Pixel 7 Pro) and from the bottom by navigationBarHeight.
    • Inside ReanimatedModal (src/components/Modal/ReanimatedModal/index.tsx lines 254–260), when avoidKeyboard is true, the modal content is wrapped in react-native-keyboard-controller's <KeyboardAvoidingView behavior="padding">.
    • In react-native-keyboard-controller's KeyboardAvoidingView (src/components/KeyboardAvoidingView/index.tsx lines 98–107), relativeKeyboardHeight() computes:
      const keyboardY = screenHeight - keyboard.height.value;
      return Math.max(frame.value.y + frame.value.height - keyboardY, 0);
      
      Here, screenHeight comes from the Activity's full edge-to-edge window (where statusBarTranslucent = true), while frame.value comes from onLayout inside the modal's dialogRootViewGroup (frame.value.y = 0, frame.value.height = screenHeight - statusBarHeight - navigationBarHeight).
    • Because frame.value.y is 0 relative to dialogRootViewGroup instead of reflecting the statusBarHeight top offset applied by fitsSystemWindows = true, frame.value.y + frame.value.height under-reports the view's bottom screen coordinate by statusBarHeight.
    • As a result, KeyboardAvoidingView applies paddingBottom that is short by statusBarHeight, leaving the bottom-docked "Apply" button overlapped by the top of the Android keyboard!

What changes do you think we should make in order to solve the problem?

In src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx (line 58), change the default value of statusBarTranslucent from false to true so PopoverWithMeasuredContent is consistent with BaseModal, ReanimatedModal, and KeyboardProvider:

--- a/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx
+++ b/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx
@@ -55,7 +55,7 @@ function PopoverWithMeasuredContentBase({
     shouldSwitchPositionIfOverflow = false,
     shouldHandleNavigationBack = false,
-    statusBarTranslucent = false,
+    statusBarTranslucent = true,
     avoidKeyboard = true,
     ...props
 }: PopoverWithMeasuredContentProps) {

With statusBarTranslucent = true, the modal's coordinate space on Android matches the main window and KeyboardProvider, so KeyboardAvoidingView calculates the exact relativeKeyboardHeight and pushes the "Apply" button completely above the keyboard.

What alternative solutions did you explore? (Optional)

  • Passing statusBarTranslucent only in FilterPopupButton.tsx was considered, but every other modal in the app already defaults statusBarTranslucent = true in BaseModal.tsx and ReanimatedModal/index.tsx. Updating the default in PopoverWithMeasuredContentBase.tsx fixes all PopoverWithMeasuredContent popups with inputs on Android consistently.

huhuli083-creator avatar Oct 27 '26 19:10 huhuli083-creator

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f7d7991785f2ee01

apoorv-xs avatar Oct 28 '26 05:10 apoorv-xs

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 28 '26 05:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Android native, when opening an exposed filter popup in Spend > Expenses (such as Withdrawal ID, Merchant, Description, or Title) and focusing the text input to open the soft keyboard, the bottom Apply button is overlapped by the top of the keyboard and cannot be scrolled to.

What is the root cause of that problem?

  1. Exposed filter popups are rendered inside <PopoverWithMeasuredContent> via src/components/Search/FilterDropdowns/FilterPopupButton.tsx.
  2. Across the codebase, <KeyboardProvider> (src/components/KeyboardProvider/index.tsx:7-9), <BaseModal> (src/components/Modal/BaseModal.tsx:117-118), and <ReanimatedModal> (src/components/Modal/ReanimatedModal/index.tsx:55-56) all default to:
    statusBarTranslucent = true,
    navigationBarTranslucent = true,
    
  3. However, src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx (line 58) is the only modal wrapper in the codebase that still defaults statusBarTranslucent to false:
    statusBarTranslucent = false,
    
    and forwards statusBarTranslucent={statusBarTranslucent} down to <Popover> (line 237) -> <Modal> (BaseModal.tsx:322) -> <ReanimatedModal> -> React Native's <Modal>.
  4. On Android (ReactModalHostView.kt), combining navigationBarTranslucent = true with statusBarTranslucent = false sets fitsSystemWindows = true on the modal Dialog's contentView, which insets the modal's root view group from the top by statusBarHeight.
  5. When avoidKeyboard is true, ReanimatedModal (src/components/Modal/ReanimatedModal/index.tsx:254-260) wraps the content in react-native-keyboard-controller's <KeyboardAvoidingView behavior="padding">, which calculates:
    const keyboardY = screenHeight - keyboard.height.value;
    return Math.max(frame.value.y + frame.value.height - keyboardY, 0);
    
    Because screenHeight is measured from the full edge-to-edge Activity window (statusBarTranslucent = true) while frame.value inside the non-translucent modal Dialog has frame.value.y = 0 and frame.value.height = screenHeight - statusBarHeight - navigationBarHeight, frame.value.y + frame.value.height under-reports the bottom screen coordinate by exactly statusBarHeight. Consequently, KeyboardAvoidingView's paddingBottom falls short by statusBarHeight, leaving the Apply button covered by the top of the keyboard.

What changes do you think we should make in order to solve the problem?

In src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx (line 58), change the default of statusBarTranslucent from false to true so PopoverWithMeasuredContent matches BaseModal, ReanimatedModal, and KeyboardProvider:

--- a/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx
+++ b/src/components/PopoverWithMeasuredContent/PopoverWithMeasuredContentBase.tsx
@@ -55,7 +55,7 @@ function PopoverWithMeasuredContentBase({
     shouldSwitchPositionIfOverflow = false,
     shouldHandleNavigationBack = false,
-    statusBarTranslucent = false,
+    statusBarTranslucent = true,
     avoidKeyboard = true,
     ...props
 }: PopoverWithMeasuredContentProps) {

What alternative solutions did you explore? (Optional)

  • MelvinBot's proposal (disabling avoidKeyboard and manually animating paddingBottom in FilterPopupButton.tsx): Rejected because it works around a broken modal window coordinate space in a single caller while leaving PopoverWithMeasuredContentBase.tsx out of sync with BaseModal and ReanimatedModal. Aligning statusBarTranslucent = true in PopoverWithMeasuredContentBase.tsx fixes the root coordinate mismatch for all PopoverWithMeasuredContent popups on Android with a 1-line change.

Enes2553 avatar Oct 28 '26 17:10 Enes2553

@brunovjk I have reproduced this issue on a physical Android device and have verified a smooth, working fix. Before submitting my proposal, I wanted to share our findings on MelvinBot's proposal and why it has critical gaps on native Android.

Key Gaps in Melvin's Proposal:

  1. Missed Root Cause for the Layout Drop: Melvin only attributed the issue to modal keyboard avoidance, missing that FilterPopupButton actively strips its 48dp bottom safe area padding as soon as an input is focused (isKeyboardActive). This causes the sheet to drop down under the keyboard before any adjustment occurs.
  2. Desktop & Wide Layout Regression: Melvin suggests stopping passing avoidKeyboard altogether. Because PopoverWithMeasuredContentBase defaults avoidKeyboard to false, this turns off keyboard avoidance globally, regressing desktop and wide-screen popovers.
  3. Untested Pseudo-Code: As Melvin noted in its investigation notes, it only tested on Web with medium confidence. Its proposed snippet is a conceptual sketch that cannot run as written (it lacks Reanimated worklet styling, shared value handling, and safe area inset integration).

My Approach:

I implemented and tested the complete, production-ready solution on a physical Android device. It preserves avoidKeyboard for desktop/wide screens, extracts true safe area insets via UI worklets, and animates the bottom padding dynamically so the sheet stays seamlessly above the 3-button navigation bar when closed and smoothly floats above the keyboard when open, with zero layout jumps or regressions.

Demos:

  • Repro demo:

    https://github.com/user-attachments/assets/3a0595fb-3290-4815-a4d3-64ee92f78c69

  • Fix demo:

https://github.com/user-attachments/assets/c8e276d3-aa13-48c7-ac38-aa12e5342e10

Would you like us to submit our full proposal with the exact code changes and details for your review?

emkhalid avatar Oct 30 '26 19:10 emkhalid

@brunovjk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Oct 30 '26 21:10 melvin-bot[bot]

Melvin’s proposal does not yet clearly explain why the existing keyboard avoidance leaves “Apply” covered, or how the proposed padding would address that behavior without double compensation. Thanks @emkhalid for the investigation.

:sos: C+ Help Wanted

brunovjk avatar Nov 03 '26 12:11 brunovjk

🚨 Edited by proposal-police: This proposal was edited at 2026-11-12 14:47:33 UTC.

Proposal

What is the root cause of that problem?

I found that exposed text filters render TextFilterPopup, whose input and Apply button are placed sequentially inside a plain, non-scrollable View.

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Search/FilterDropdowns/BasePopup.tsx#L44-L69

On narrow native screens, FilterPopupButton relies entirely on the modal-level avoidKeyboard behavior and explicitly disables the bottom-docked scroll wrapper.

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L136-L164

That flag wraps the whole modal in a padding-based KeyboardAvoidingView.

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Modal/ReanimatedModal/index.tsx#L243-L260

It calculates the padding as frame.y + frame.height - (screenHeight - keyboardHeight). frame comes from onLayout, so it is relative to the modal content, but screenHeight and keyboard height are relative to the whole window.

https://github.com/kirillzyusko/react-native-keyboard-controller/blob/af130ca4f9d77061ca098dd4aaec13dda3d5b11f/src/components/KeyboardAvoidingView/index.tsx#L102-L108

In HybridApp on Android 12 the modal content starts below the status bar, but frame.y is still 0, so the status bar is missing from the calculation. I measured it on HybridApp, Android 12 emulator (1080x2400), Withdrawal ID popup with keyboard open:

  • status bar is 63px, modal content starts at y=63 but frame.y is 0
  • keyboard top is y=1523, so needed padding is 751px, calculated padding is 688px
  • sheet ends at y=1586, so its last 63px (exactly the status bar) and bottom of Apply stay under the keyboard
  • on standalone build, same emulator, same popup, Apply ends 63px higher and is fully visible

Same happens after rotating to landscape with popup open. Since neither layer can scroll, the user cannot reach Apply.

The history confirms that avoidKeyboard has been part of this filter wrapper since exposed filter popovers were introduced; the Withdrawal ID work did not add this layout.

What changes do you think we should make in order to solve the problem?

I think we should handle keyboard space inside FilterPopupButton on narrow, non-tablet layouts. I would use useReanimatedKeyboardAnimation, change the content wrapper to Animated.View, and animate its bottom padding to the larger of the safe-area inset and keyboard height. At the same time, disable avoidKeyboard for that case so both mechanisms do not add keyboard space.

A small illustration:

- <PopoverWithMeasuredContent avoidKeyboard>
-   <View style={[containerStyles, bottomSafeAreaPaddingStyle]}>
+ <PopoverWithMeasuredContent avoidKeyboard={!shouldPadForKeyboard}>
+   <Animated.View style={[containerStyles, keyboardRoomStyle]}>
      {popoverContent}
-   </View>
+   </Animated.View>

Step 2: also pass shouldLimitHeightIfBottomDockedInLandscapeMode={!shouldPadForKeyboard} to the popover, same as AnchoredSelectionListPopover does, so the sheet is not capped at 75% of window height when rotated to landscape with keyboard open.

This follows the existing selection-list implementation, including its tablet guard, where keyboard padding is animated inside the bottom sheet rather than delegated to the modal wrapper.

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/hooks/useSelectionListPopoverLayout.ts#L62-L70

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/hooks/useSelectionListPopoverLayout.ts#L89-L106

The added bottom room moves the existing Apply button above the keyboard without changing submission, validation, or filter state. Wide popovers and tablets retain their current layout, and every exposed text filter benefits because they share FilterPopupButton.

What alternative solutions did you explore? (Optional)

I considered wrapping BasePopup in a ScrollView. That would make the button reachable, but it would add scrolling to every popup, including short and non-text filters, while still initially leaving Apply behind the keyboard. Changing the shared modal keyboard offset would have a much wider impact on unrelated modals.

mukhrr avatar Nov 03 '26 12:11 mukhrr

Proposal

What is the root cause of that problem?

The root cause is that FilterPopupButton relies on modal-level avoidKeyboard while prematurely stripping its own safe area padding when the keyboard activates, which fails on Android because native Dialog window insets do not propagate to the modal's keyboard-avoiding container.

When a user taps an input inside an exposed filter on Android: The input gains focus -> isKeyboardActive becomes true -> FilterPopupButton immediately removes its 48dp bottom safe area padding via bottomSafeAreaPaddingStyle:

https://github.com/Expensify/App/blob/a1a2f804c4240bde536191f40f8a07b83386b605/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L73-L78

Meanwhile, PopoverWithMeasuredContent delegates keyboard handling to ReanimatedModal's KeyboardAvoidingView:

https://github.com/Expensify/App/blob/a1a2f804c4240bde536191f40f8a07b83386b605/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L145-L148

Because the Android modal is rendered in a separate native Dialog, KeyboardAvoidingView does not resize or lift the modal. Consequently, the popover content loses its safe area padding and drops down underneath the soft keyboard, completely hiding the "Apply" and "Reset" action buttons.

What changes do you think we should make in order to solve the problem?

We will adopt the established NewDot bottom sheet pattern from useSelectionListPopoverLayout by animating the content's bottom padding directly on the UI thread and disabling modal-level keyboard avoiding on narrow screens.

In src/components/Search/FilterDropdowns/FilterPopupButton.tsx:

https://github.com/Expensify/App/blob/a1a2f804c4240bde536191f40f8a07b83386b605/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L73-L81

  1. Replace useKeyboardState and useBottomSafeSafeAreaPaddingStyle with useReanimatedKeyboardAnimation, useSafeAreaPaddings(true), and useAnimatedStyle to compute dynamic padding matching whichever is larger between the keyboard offset and safe area inset:
const {paddingBottom: safeAreaPaddingBottom} = useSafeAreaPaddings(true);
const {height: keyboardOffset} = useReanimatedKeyboardAnimation();
const keyboardRoomStyle = useAnimatedStyle(() => ({
    paddingBottom: Math.max(safeAreaPaddingBottom, -keyboardOffset.get()),
}));
  1. On PopoverWithMeasuredContent, set avoidKeyboard={!isSmallScreenWidth} to prevent duplicate or conflicting keyboard adjustments on mobile while keeping avoidKeyboard enabled for desktop and wide layouts:

https://github.com/Expensify/App/blob/a1a2f804c4240bde536191f40f8a07b83386b605/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L145-L168

<PopoverWithMeasuredContent
    anchorRef={triggerRef}
    avoidKeyboard={!isSmallScreenWidth}
  1. Wrap {popoverContent} in an Animated.View with keyboardRoomStyle on narrow screens:
<Animated.View style={[containerStyles, isSmallScreenWidth ? keyboardRoomStyle : undefined]}>
    {popoverContent}
</Animated.View>

This reuses the standard pattern in useSelectionListPopoverLayout. Because the animation runs on the Reanimated UI worklet thread and tracks keyboard height directly, the sheet smoothly lifts above the soft keyboard on all mobile devices without depending on Dialog window insets, while leaving desktop and tablet popovers completely unchanged with zero risk of regression.

What alternative solutions did you explore? (Optional)

Alternative 1: Activity content view & root coordinate offset measurement (automaticOffset)

Instead of handling the bottom sheet padding via useReanimatedKeyboardAnimation, we can resolve the coordinate disparity directly at the keyboard avoiding calculation level in react-native-keyboard-controller / BaseKeyboardAvoidingView.

When automaticOffset is enabled on Android, KeyboardAvoidingView measures the sheet relative to the whole screen. In full-screen mode, this includes the native dialog offset. However, in Android split-screen (multi-window) mode where Expensify occupies only the bottom half of the screen, the space above the app pane is mistakenly counted as additional overlap, lifting the sheet too high and clipping the header.

To solve this via coordinate offset:

  • Measure the root activity content view's screen position (rootScreenY) alongside the sheet's screen position.
  • For Android's automatic offset calculation, subtract rootScreenY from the sheet's screen position and use the accompanying activity content height to calculate the keyboard's top.
  • This includes the dialog offset in full-screen mode while removing the unrelated distance above a split-screen pane.

Comparison with Main Proposal: While the coordinate offset approach operates at the container level, it requires either maintaining an external library patch (patch-package) for react-native-keyboard-controller or introducing native measurement bindings. The main proposal uses the established NewDot pattern from useSelectionListPopoverLayout, runs cleanly on the UI thread without external patches, and is safely scoped to FilterPopupButton.

Alternative 2: Wrap popup content in KeyboardAvoidingView inside FilterPopupButton

Wrap {popoverContent} inside FilterPopupButton.tsx with KeyboardAvoidingView from react-native-keyboard-controller using behavior="padding" while setting avoidKeyboard={false} on PopoverWithMeasuredContent:

<PopoverWithMeasuredContent
    avoidKeyboard={false}
    ...
>
    <KeyboardAvoidingView behavior="padding" style={containerStyles}>
        <View style={[containerStyles, bottomSafeAreaPaddingStyle]}>
            {popoverContent}
        </View>
    </KeyboardAvoidingView>
</PopoverWithMeasuredContent>

This uses declarative keyboard avoiding directly inside the modal content tree where layout measurements are localized, avoiding conflicts with outer dialog insets while preserving the existing safe area hooks.

Repro demo

https://github.com/user-attachments/assets/e84c067c-5736-463a-884a-0aedd294b55a

Fix demo

https://github.com/user-attachments/assets/0a5fc70f-a692-4020-ab5e-6c815bb8b7ff

emkhalid avatar Nov 03 '26 12:11 emkhalid

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Android app, after applying a Withdrawal ID filter in Spend > Expenses, tapping the exposed filter chip opens a bottom sheet with the Withdrawal ID text input. When the input is focused, the keyboard covers the sheet's Apply button, and the sheet cannot be scrolled, so the button is unreachable while editing.

What is the root cause of that problem?

The exposed filter chip renders its popup through FilterPopupButton, which opens the content as a bottom-docked popover with the modal-level avoidKeyboard flag:

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L138-L148

On narrow screens that popover is a React Native modal rendered by ReanimatedModal, where avoidKeyboard wraps the content in react-native-keyboard-controller's KeyboardAvoidingView with the padding behavior:

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Modal/ReanimatedModal/index.tsx#L250-L257

That component calculates its bottom padding by comparing its own onLayout frame against the keyboard's position derived from the physical screen height (padding = frame bottom minus the keyboard's top, where the keyboard's top is computed as screen height minus keyboard height). Inside a native modal window on Android, the frame reported by onLayout is relative to the modal's own window and does not line up with those screen coordinates. The library documents this exact pitfall and ships an automaticOffset option that makes the view "automatically detect its position on screen, accounting for navigation headers, modals, and other layout offsets" (see https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-avoiding-view). ReanimatedModal leaves that option off, so the computed padding comes up short by the coordinate difference — roughly the height of the system bars. That matches the reporter's video: the sheet does rise when the keyboard opens, but stops short, leaving the Apply button behind the keyboard.

Because the popup body is a plain non-scrollable column — a label, the text input and the action buttons — there is also no way to scroll the hidden button into view:

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Search/FilterDropdowns/TextFilterPopup.tsx#L45-L68

The popup itself is small (one input plus two buttons), so it comfortably fits in the space above the keyboard; the sheet is mis-positioned rather than too tall. The same popup component serves every plain text filter chip (Withdrawal ID, Report ID, Keyword, and so on), so all of them are affected on Android.

What changes do you think we should make in order to solve the problem?

In ReanimatedModal, enable the keyboard controller's automatic offset detection on the KeyboardAvoidingView that wraps avoidKeyboard modals. With that option the library resolves the view's true on-screen position through a native lookup instead of trusting the modal-relative layout frame, so the computed padding matches the real keyboard overlap and the bottom sheet rises fully above the keyboard. The Apply button then stays visible and tappable while editing the Withdrawal ID, and the same holds for every other text filter chip.

This fixes the problem at its source for all bottom-docked popovers that rely on the modal's keyboard avoidance. Where the view's frame already matches the screen coordinates (iOS and regular full-screen windows) the detected offset resolves to zero, so behavior there is unchanged.

What alternative solutions did you explore? (Optional)

Capping the popup's height to the room above the keyboard, as was recently done for the Merchant chip popup:

https://github.com/Expensify/App/blob/4249ad6d2ebe16c04b65a0808c23acd457cd2f38/src/components/Search/FilterDropdowns/MerchantFilterPopup.tsx#L52-L57

That approach helps when the popup content is taller than the space above the keyboard, but this popup is a single input and already fits comfortably in that space — the sheet is positioned too low, not sized too tall — so a height cap alone does not bring the Apply button out from behind the keyboard. It could still be added to TextFilterPopup on top of the main fix as a guard for very short windows, for example phones in landscape.

Another option is to stop relying on the modal-level avoidance for this popup and instead animate bottom padding inside the sheet in step with the keyboard, the way the category and tag picker sheets do through useSelectionListPopoverLayout. That also works, but it is more invasive: the modal-level avoidance must be disabled for the popup to avoid double padding, and it re-implements per popup what the modal can do correctly once.

wildan-m avatar Nov 03 '26 12:11 wildan-m

🚨 Edited by proposal-police: This proposal was edited at 2026-11-03 22:29:02 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Android, tapping an applied text filter chip in Spend (Withdrawal ID here; Description, Report ID, Merchant and the other text chips behave the same) opens a bottom sheet. When its text input raises the keyboard, the sheet rises but stops short, so the Apply button ends up behind the keyboard, and since the sheet does not scroll there is no way to reach it.

What is the root cause of that problem?

On a small screen the chip's popup is a bottom-docked Modal, which on Android is a separate native Dialog window, and FilterPopupButton asks that modal to avoid the keyboard:

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L143-L145

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/PopoverWithMeasuredContent/index.tsx#L35-L39

avoidKeyboard wraps the whole sheet in keyboard-controller's padding KeyboardAvoidingView at the modal root:

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Modal/ReanimatedModal/index.tsx#L243-L250

That view pads by frame.y + frame.height - (screenHeight - keyboardHeight):

https://github.com/kirillzyusko/react-native-keyboard-controller/blob/1.22.4/src/components/KeyboardAvoidingView/index.tsx#L102-L108

Its two inputs come from two different windows. frame is the view's own onLayout inside the Dialog, so frame.y is 0 and frame.height is the Dialog's content height. screenHeight is the height of the activity's content view, reported by a listener the library attaches once per app to the activity, never to a Dialog:

https://github.com/kirillzyusko/react-native-keyboard-controller/blob/1.22.4/android/src/main/java/com/reactnativekeyboardcontroller/listeners/WindowDimensionListener.kt#L23-L39

The formula is only right when the Dialog's content covers the same area as the activity. In the HybridApp on Android below 15 it does not. The modal is opened with both bars translucent (BaseModal defaults), but right after the Dialog is shown React Native's StatusBarModule syncs the status bar onto the new window, and when React Native's edge-to-edge flag is off that path calls setDecorFitsSystemWindows(true), which insets the Dialog's content under the status bar and above the navigation bar:

https://github.com/facebook/react-native/blob/v0.86.0/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt#L355

https://github.com/facebook/react-native/blob/v0.86.0/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt#L49-L61

https://github.com/facebook/react-native/blob/v0.86.0/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/WindowUtil.kt#L146-L161

The standalone build turns that flag on (edgeToEdgeEnabled=true in android/gradle.properties), and React Native turns it on by itself on Android 15+ (isAtLeastTargetSdk35 needs the device on 15+). The HybridApp host on Android 12 has neither, which is why this only reproduces there.

With screen height S, status bar s, navigation bar n and keyboard k (keyboard-controller reports the full IME inset because the app's KeyboardProvider runs with navigationBarTranslucent): the Dialog content is S - s - n tall, screenHeight is S, so the padding is (S - s - n) - (S - k) = k - s - n. The sheet's bottom edge sits n above the screen bottom, so it needs k - n to meet the keyboard. The lift is short by exactly s, the status bar. That matches the video: the sheet does rise when the keyboard opens, then stops a status-bar height short, with Apply behind the keyboard.

Two smaller things in the same video, so it is clear they are not the cause:

  • The sheet gives back its bottom safe-area padding the moment isKeyboardActive flips, which is the small drop visible mid-animation. Keeping it would only mask the shortfall on devices whose bottom inset happens to be taller than their status bar, and the sheet would still be lifted by the wrong amount.

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Search/FilterDropdowns/FilterPopupButton.tsx#L73-L77

  • BasePopup is a plain View and the modal's scroll wrapper is turned off, so once Apply is covered nothing can scroll to it.

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Search/FilterDropdowns/BasePopup.tsx#L47-L68

The sheet is placed too low, not sized too tall: one input and two buttons fit comfortably above the keyboard. That is why a keyboard-aware maxHeight or a ScrollView in TextFilterPopup (the approach in the first version of this proposal) does not help here; neither engages for content that already fits. In landscape the chips do not open this sheet at all, they navigate to the Filters page, so a scroll fallback has no case left to cover:

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Search/SearchPageHeader/useSearchFiltersBar.tsx#L193

What changes do you think we should make in order to solve the problem?

Let the sheet make its own room for the keyboard and stop asking the modal for it, the way the searchable selection-list sheets already do:

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/hooks/useSelectionListPopoverLayout.ts#L96-L105

In FilterPopupButton:

  1. On small screens pass avoidKeyboard={false} to PopoverWithMeasuredContent. Wide layouts keep it, so anchored popovers are unchanged (on web the modal already forces it off).
  2. Replace the useKeyboardState-gated useBottomSafeSafeAreaPaddingStyle with useSafeAreaPaddings(true) and useReanimatedKeyboardAnimation, and make the content wrapper an Animated.View whose bottom padding is the larger of the safe-area inset and the keyboard height.
const shouldPadForKeyboard = isSmallScreenWidth;
const {height: keyboardOffset} = useReanimatedKeyboardAnimation();
const keyboardRoomStyle = useAnimatedStyle(() => ({paddingBottom: Math.max(safeAreaPaddingBottom, -keyboardOffset.get())}));

<PopoverWithMeasuredContent avoidKeyboard={!shouldPadForKeyboard} ...>
    <Animated.View style={[containerStyles, shouldPadForKeyboard && keyboardRoomStyle]}>{popoverContent}</Animated.View>

Why this fixes it: the padding reads only the keyboard height, which comes from the window's IME inset and is the same number in the Dialog and in the activity window. No window height and no Dialog-local frame enters the math, so there is nothing left to be off by, in the HybridApp or standalone, on Android or iOS. It animates on the UI thread in step with the keyboard, so the mid-animation drop disappears as well.

Why there is no double compensation: with avoidKeyboard off the modal's KeyboardAvoidingView is gone, so the wrapper's padding is the only keyboard room; BaseModal adds no bottom padding of its own to this popover because it runs in edge-to-edge mode; and max() means the safe-area inset and the keyboard are never added together, since the keyboard covers the home indicator:

https://github.com/Expensify/App/blob/30ca2776f0e98ec4455813b742fae9046657535d/src/components/Modal/BaseModal.tsx#L295-L301

This is also consistent with the open change that stops BaseModal from adding a top safe-area margin to a sheet that does not avoid the keyboard (https://github.com/Expensify/App/pull/105596): a sheet that pads itself is not lifted, so it should get no such margin, and this one-input sheet is far too short to trigger it anyway.

Every chip goes through FilterPopupButton, so Withdrawal ID, Description, Report ID, Keyword, Merchant and Display > Limit are all fixed by the one change, on phones and on narrow tablet windows alike. MerchantFilterPopup's keyboard-aware maxHeight still holds, since the room above the keyboard is unchanged.

Tests: tests/unit/components/FilterPopupButtonTest.tsx, 3 tests, 2 of them red on main: on a small screen the popover gets avoidKeyboard={false} and the wrapper's padding equals the keyboard height while it is open and the safe-area inset while it is closed; on a wide layout avoidKeyboard stays on and no padding is added. TextFilterPopupTest, MerchantFilterPopupTest, CategoryPickerModalTest and TaxPickerModalTest pass unchanged, and the component compiles and memoizes under React Compiler.

Test branch:

https://github.com/Expensify/App/compare/main...abbasifaizan70:Expensify:105145?expand=1

Demo

https://github.com/user-attachments/assets/01601e48-7054-4ca7-90cc-d016f96a6425

abbasifaizan70 avatar Nov 03 '26 12:11 abbasifaizan70

🚨 Edited by proposal-police: This proposal was edited at 2026-11-03 12:45:37 UTC.

Proposal

What is the root cause of that problem?

On small screens the text filter chips open through FilterPopupButton, which asks the modal to handle the keyboard (avoidKeyboard). ReanimatedModal then wraps the sheet in keyboard-controller's padding KeyboardAvoidingView (ReanimatedModal#L244-L250).

That KAV does lift the sheet, it just lifts it too little. I stepped through the reporter's video at 30fps and measured it (px are in the 720x1640 recording):

px
keyboard height (it covers the nav bar area too) 560
status bar 78
sheet's resting bottom edge (40px above the screen bottom) 1600
keyboard top once open 1080
lift needed so the sheet ends at the keyboard top (1600 - 1080) 520
lift the KAV actually applied 444

So it comes up 76px short, which is the status bar height. That's exactly what the KAV formula gives in this window:

KeyboardAvoidingView#L100-L108

const keyboardY = screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;
return Math.max(frame.value.y + frame.value.height - keyboardY, 0);

The two inputs come from two different windows:

  • screenHeight is the height of the activity's content view, which is the full screen, 1640 (WindowDimensionListener.kt#L53-L58)
  • frame is the KAV's own onLayout inside the modal Dialog. Here the Dialog content sits between the system bars, so the frame is 1640 - 78 - 40 = 1522 tall and still reports y = 0 even though it starts under the status bar

Plugging in: 0 + 1522 - (1640 - 560) = 442, matching the 444 in the video. The status bar offset is lost because y is Dialog-local, so the sheet stops 78px too low and "Apply" (plus its 16dp bottom padding) ends up under the keyboard.

Two smaller things in the same video, so it's clear they're not the cause:

  • At ~0:19.43, mid animation, the sheet gives back 40px. That's isKeyboardActive flipping and removing the bottom safe-area padding (FilterPopupButton#L73-L78). Without that, Apply would end at 1089 vs a keyboard top of 1080, so still covered. The toggle only exists because the sheet has two things deciding its bottom space (the modal KAV and its own padding)
  • BasePopup is a plain View (BasePopup#L47-L69), so once Apply is covered nothing can scroll to it

What changes do you think we should make in order to solve the problem?

On narrow, non-tablet layouts let the sheet reserve its own keyboard space from the keyboard height alone, and stop asking the modal for it. This is what useSelectionListPopoverLayout already does for the list chips (#L68, #L96-L105), so the text and merchant chips would just match them.

In FilterPopupButton:

  1. shouldPadForKeyboard = isSmallScreenWidth && !isTabletDevice, and pass avoidKeyboard={!shouldPadForKeyboard} so wide layouts keep the modal KAV
  2. Remove the useKeyboardState / !isKeyboardActive gating
  3. Make the content wrapper an Animated.View and, when shouldPadForKeyboard, give it:
const {height: keyboardOffset} = useReanimatedKeyboardAnimation();
const keyboardRoomStyle = useAnimatedStyle(() => ({
    paddingBottom: Math.max(safeAreaPaddingBottom, -keyboardOffset.get()),
}));

Why this fixes it without double compensation:

  • The value only uses the keyboard height (560), which comes from the IME insets. It never reads screenHeight or the Dialog-local frame, so the 78px mismatch above can't get in
  • With the modal KAV off, this is the only thing adding bottom space, and max() means the inset and the keyboard are never added together
  • It follows the keyboard frame by frame on the UI thread, so the mid-animation 40px jump goes away too

With the numbers from the video the sheet ends at or above the keyboard top, never under it. This covers every chip that goes through FilterPopupButton (Withdrawal ID, Description, Report ID, Merchant, ...).

Tests: render FilterPopupButton with isSmallScreenWidth: true and a mocked useReanimatedKeyboardAnimation. Check that the popover gets avoidKeyboard={false}, that the wrapper's padding equals the keyboard height when it's bigger than the inset and falls back to the inset when the keyboard is closed, and that wide layouts and tablets still pass avoidKeyboard.

Test branch: main...David-2002065:App:fix/105145-filter-popup-keyboard

What alternative solutions did you explore? (Optional)

  • Pass automaticOffset to the modal KAV, as one of the proposals above suggests. keyboard-controller then reads the view's on-screen y (78 here), which would land at 520. It's a fair option, but it changes every avoidKeyboard modal in the app, and the offset arrives through an async native call after the first layout, so it needs much wider QA for a one-sheet bug
  • Keep the KAV and stop removing the safe-area padding. From the numbers above Apply would still be 9px under the keyboard, so it doesn't fix it
  • Add a ScrollView / keyboard-aware maxHeight to TextFilterPopup like MerchantFilterPopup. It makes Apply reachable, but the popup is short and already fits above the keyboard. The sheet is placed too low, not too tall, so the user would still open it with Apply hidden. Fine as a landscape safety net next to the main fix

David-2002065 avatar Nov 03 '26 12:11 David-2002065