Skip to content

Use landscape-aware scrollable layout on Edit Agent and AI Rule pages#93446

Merged
NicolasBonet merged 3 commits into
mainfrom
claude-landscapeAgentAIRuleFooter
Jun 15, 2026
Merged

Use landscape-aware scrollable layout on Edit Agent and AI Rule pages#93446
NicolasBonet merged 3 commits into
mainfrom
claude-landscapeAgentAIRuleFooter

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

In landscape orientation on iOS/Android, the docked footer (Save/Delete) button ate into the limited vertical space and the page couldn't scroll to reveal the full form, making the multiline prompt input hard to use.

AddAgentPage already fixed this with a landscape-aware scrollable layout. This PR applies the same pattern to its three sibling pages:

  • src/pages/settings/Agents/Fields/EditPromptPage.tsx
  • src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx
  • src/pages/workspace/rules/AgentRules/EditAgentRulePage.tsx

In landscape, the footer moves into the scroll content and the multiline input gets a minimum height. Portrait is unchanged.

Fixed Issues

$ #93182

Tests

For each of the three pages below, rotate the device to landscape before/while the page is open:

  1. Edit Agent prompt: Settings → Agents → open an agent → tap the prompt/instructions field to open the edit page.
  2. Add Agent Rule: Open a workspace → Rules → Agent Rules → Add rule.
  3. Edit Agent Rule: Open a workspace → Rules → Agent Rules → tap an existing rule.

On each page in landscape, verify:

  • The footer button (Save on Add/prompt pages, Save/Delete on the Edit Rule page) is not stuck to the bottom of the screen — it sits at the end of the scrollable content.

  • The whole page scrolls, so the full form (heading, subtitle, input, disclaimer, and footer button) is reachable.

  • The multiline prompt input keeps a sensible minimum height (it isn't collapsed to a thin line).

  • You can type into the input, scroll down, and tap the footer button without the keyboard/footer obscuring the field.

  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as Tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

…e pages

In landscape on native, un-dock the footer button into the scrollable view
and give the multiline prompt input a minimum height, matching AddAgentPage.
Portrait behavior is unchanged.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...rc/pages/settings/Agents/Fields/EditPromptPage.tsx 70.00% <100.00%> (+1.57%) ⬆️
...es/workspace/rules/AgentRules/AddAgentRulePage.tsx 0.00% <0.00%> (ø)
...s/workspace/rules/AgentRules/EditAgentRulePage.tsx 0.00% <0.00%> (ø)
... and 10 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I analyzed the checks — there's no code failure to fix.

The only red check is PR Author Checklist / checklist, which fails because the checklist items in the PR description are still unchecked (and the ### Tests / ### QA Steps sections still have their // TODO placeholders). That check can only be cleared by the human co-author filling out those sections and ticking the boxes — it's not something a code change can resolve.

Everything substantive is green:

  • test (job 1–8)
  • typecheck ✅ (also verified locally — no type errors in the three changed files)
  • ESLint, Prettier, Check for unused styles
  • all build (...) jobs ✅

The baseline-perf-tests / branch-perf-tests jobs are still running but are informational comparisons, not blocking.

Next step: complete the Tests/QA Steps and PR Author Checklist in the description, then re-run the checklist check.

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot pull main and fix conflict, simplify Explanation of Change

…AIRuleFooter

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>

# Conflicts:
#	src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx
#	src/pages/workspace/rules/AgentRules/EditAgentRulePage.tsx
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged main and resolved the conflict.

What conflicted: main renamed the AI Rules pages and translation keys (AIRulesAgentRules, aiRulesagentRules), while this PR modified the old-named files to add the landscape-aware scrollable layout. Git surfaced this as a content conflict on the two renamed files:

  • src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx
  • src/pages/workspace/rules/AgentRules/EditAgentRulePage.tsx

Resolution: Kept main's renamed translation keys and the agentRule variable, plus this PR's landscape View wrapper (shouldUseScrollableLayout && styles.minHeight42). Verified no conflict markers remain, no stale aiRule/aiRules references, and all required imports/hooks are present. lint-changed passes.

I also simplified the Explanation of Change in the PR description and updated the file paths to their renamed locations.

ℹ️ typecheck-tsgo reports pre-existing duplicate-identifier errors in src/libs/API/types.ts (UPDATE_FINANCIAL_FORCE_*). These exist on main and are unrelated to this PR's changes.

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot suggest QA steps

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Suggested QA steps (for the human co-author to verify and paste into the QA Steps section).

This PR only changes native landscape behavior on three form pages, so QA should cover landscape + portrait on iOS/Android native. The pages are:

Pre-req: an account with the AI Agents / Agent Rules feature enabled.

Landscape (the fix) — repeat on iOS Native and Android Native

For each of the three pages below, rotate the device to landscape before/while the page is open:

  1. Edit Agent prompt: Settings → Agents → open an agent → tap the prompt/instructions field to open the edit page.
  2. Add Agent Rule: Open a workspace → Rules → Agent Rules → Add rule.
  3. Edit Agent Rule: Open a workspace → Rules → Agent Rules → tap an existing rule.

On each page in landscape, verify:

  • The footer button (Save on Add/prompt pages, Save/Delete on the Edit Rule page) is not stuck to the bottom of the screen — it sits at the end of the scrollable content.
  • The whole page scrolls, so the full form (heading, subtitle, input, disclaimer, and footer button) is reachable.
  • The multiline prompt input keeps a sensible minimum height (it isn't collapsed to a thin line).
  • You can type into the input, scroll down, and tap the footer button without the keyboard/footer obscuring the field.

Portrait (regression check) — iOS/Android native + web

For the same three pages in portrait:

  • The footer button stays docked to the bottom (unchanged from current behavior).
  • Layout, input height, and scrolling behave exactly as before this PR.

All platforms

  • No JS console errors on any of the pages.
  • Saving a prompt/rule still works (value persists after save).

Note: portrait and web are unaffected by design — the landscape flag is false there, so the props collapse back to the existing docked-footer behavior.

@mkhutornyi

mkhutornyi commented Jun 14, 2026

Copy link
Copy Markdown
Contributor
Details

Explanation of Change

Fixed Issues

$ #93182

Tests

For each of the three pages below, rotate the device to landscape before/while the page is open:

  1. Edit Agent prompt: Settings → Agents → open an agent → tap the prompt/instructions field to open the edit page.
  2. Add Agent Rule: Open a workspace → Rules → Agent Rules → Add rule.
  3. Edit Agent Rule: Open a workspace → Rules → Agent Rules → tap an existing rule.

On each page in landscape, verify:

  • The footer button (Save on Add/prompt pages, Save/Delete on the Edit Rule page) is not stuck to the bottom of the screen — it sits at the end of the scrollable content.

  • The whole page scrolls, so the full form (heading, subtitle, input, disclaimer, and footer button) is reachable.

  • The multiline prompt input keeps a sensible minimum height (it isn't collapsed to a thin line).

  • You can type into the input, scroll down, and tap the footer button without the keyboard/footer obscuring the field.

  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as Tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

@MelvinBot please set the PR body to the content in the details section above. Just copy Explanation of Change from yours
And mark as ready for review

@MelvinBot MelvinBot marked this pull request as ready for review June 14, 2026 12:28
@MelvinBot MelvinBot requested a review from a team as a code owner June 14, 2026 12:28
@melvin-bot melvin-bot Bot requested review from heyjennahay and mkhutornyi and removed request for a team June 14, 2026 12:28
@melvin-bot

melvin-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

const {translate} = useLocalize();
const styles = useThemeStyles();
const {windowWidth, windowHeight} = useWindowDimensions();
const shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-3 (docs)

The expression useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight) along with the useWindowDimensions() call is duplicated identically across EditPromptPage.tsx, AddAgentRulePage.tsx, EditAgentRulePage.tsx, and the pre-existing AddAgentPage.tsx. This violates the DRY principle and increases the risk of the logic drifting between files.

Extract this into a dedicated custom hook, e.g.:

// src/hooks/useShouldUseScrollableLayout.ts
import useIsInLandscapeMode from '@hooks/useIsInLandscapeMode';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {isMobile} from '@libs/Browser';

export default function useShouldUseScrollableLayout(): boolean {
    const {windowWidth, windowHeight} = useWindowDimensions();
    return useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);
}

Then consume it in each page with a single const shouldUseScrollableLayout = useShouldUseScrollableLayout();.


Reviewed at: da1cf10 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

const {translate} = useLocalize();
const styles = useThemeStyles();
const {windowWidth, windowHeight} = useWindowDimensions();
const shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-3 (docs)

Same duplicated landscape/scrollable detection logic as in EditPromptPage.tsx and EditAgentRulePage.tsx. Extract to a shared custom hook (e.g., useShouldUseScrollableLayout) to eliminate the duplication.


Reviewed at: da1cf10 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

const {translate} = useLocalize();
const styles = useThemeStyles();
const {windowWidth, windowHeight} = useWindowDimensions();
const shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CONSISTENCY-3 (docs)

Same duplicated landscape/scrollable detection logic as in EditPromptPage.tsx and AddAgentRulePage.tsx. Extract to a shared custom hook (e.g., useShouldUseScrollableLayout) to eliminate the duplication.


Reviewed at: da1cf10 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da1cf10da5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const {translate} = useLocalize();
const styles = useThemeStyles();
const {windowWidth, windowHeight} = useWindowDimensions();
const shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid treating keyboard shrink as landscape

On mobile web in portrait, focusing this multiline input can shrink the live viewport height below the width, and useWindowDimensions() is based on that resized viewport. When that happens this condition flips shouldUseScrollableLayout even though the device was not rotated, which changes FormProvider from the non-scroll branch to the ScrollView branch and remounts/moves the focused input and footer while the user is typing. Use a real orientation signal or cached/screen dimensions for the mobile-web fallback; the same expression was added to the two Agent Rule pages as well.

Useful? React with 👍 / 👎.

const {translate} = useLocalize();
const styles = useThemeStyles();
const {windowWidth, windowHeight} = useWindowDimensions();
const shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot is there any pattern of using isMobile() && windowWidth > windowHeight throughout the app other than AddAgentPage to check if landscape mode on mobile web?

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Short answer: no. AddAgentPage is the only precedent. A repo-wide search for isMobile() && windowWidth > windowHeight returns exactly that file plus the three pages this PR touches — nothing else uses this expression for mobile-web landscape.

Why the extra isMobile() && windowWidth > windowHeight is there at all: useIsInLandscapeMode() is hardcoded to return false on web (hooks/useIsInLandscapeMode/index.ts); only its native impl detects orientation. So the hook alone never fires on mWeb. The isMobile() half is a userAgent check that is only truthy on web (Browser/index.web.ts:40; returns false on native). The compound useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight) therefore covers both: native landscape via the hook, mobile-web landscape via the second operand.

For context, ~30 other files use useIsInLandscapeMode() on its own — but because the web impl returns false, none of them account for mobile-web landscape. AddAgentPage is the first/only place that added the mWeb branch, and this PR replicates it for the sibling pages by design.

If you'd prefer this not be a copy-pasted expression across four files, it could be extracted into a small shared hook (e.g. useShouldUseScrollableLayout) — but that would be a new pattern, not an existing one.

@mkhutornyi

mkhutornyi commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot remove isMobile() && windowWidth > windowHeight condition in all 3 files. Don't touch AddAgentPage as out of scope.

There's bug in useWindowDimensions upstream. width is always greater than height even in portrait mode.
So shouldUseScrollableLayout = useIsInLandscapeMode() || (isMobile() && windowWidth > windowHeight) becomes true and causes this bug on portrait mode:

msafari-bug.mov

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner June 14, 2026 13:12
@melvin-bot melvin-bot Bot requested review from NicolasBonet and mkhutornyi June 14, 2026 13:12
@melvin-bot

melvin-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

@mkhutornyi @NicolasBonet One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot removed the request for review from a team June 14, 2026 13:12
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done — removed the isMobile() && windowWidth > windowHeight fallback in all 3 files, leaving just:

const shouldUseScrollableLayout = useIsInLandscapeMode();
  • src/pages/settings/Agents/Fields/EditPromptPage.tsx
  • src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx
  • src/pages/workspace/rules/AgentRules/EditAgentRulePage.tsx

AddAgentPage was left untouched as requested. Also removed the now-unused useWindowDimensions and isMobile imports from each file (grep-verified no remaining references). Prettier reports the files already formatted.

⚠️ I couldn't run lint-changed/typecheck to completion locally — eslint runs out of memory in this environment. The change is import cleanup + a boolean simplification, so CI will be the source of truth here.

@mkhutornyi

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.mov
android-landscaope.mov
Android: mWeb Chrome
iOS: HybridApp
ios.mov
ios-landscape.mov
iOS: mWeb Safari
msafari.mov
MacOS: Chrome / Safari
web.mov

@mkhutornyi mkhutornyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I left mobile web untouched because of regression in portrait mode, which makes even worse than production.

@NicolasBonet NicolasBonet merged commit 94f559e into main Jun 15, 2026
37 checks passed
@NicolasBonet NicolasBonet deleted the claude-landscapeAgentAIRuleFooter branch June 15, 2026 13:52
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.4.8-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 No help site changes required.

I reviewed the changes in this PR. This is a pure landscape-orientation layout fix for three pages (Edit Agent prompt, Add Agent Rule, Edit Agent Rule):

  • In landscape on iOS/Android, the footer moves into the scrollable content and the multiline input gets a minimum height.
  • Portrait layout is unchanged.

There are no user-facing changes that the help site documents:

  • No new features, settings, tabs, or flows
  • No new or renamed buttons/labels (the Save/Delete buttons and form fields are unchanged)
  • No behavior change — only how the page scrolls and where the footer sits in landscape

I checked the existing Agent docs (Create-Agent-Rules.md and How-to-Write-Agent-Rules.md). They describe how to create and write agent rules conceptually and remain accurate after this change.

Because no help site content is affected, I did not create a draft docs PR.

@mkhutornyi, please confirm you agree no help site changes are needed for this PR. If you believe a help article should be updated, let me know which behavior to document and I'll create the draft PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.4.8-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@lanitochka17

Copy link
Copy Markdown

Deploy Blocker ##93631 was identified to be related to this PR.

@vincdargento

Copy link
Copy Markdown

Deploy Blocker ##93639 was identified to be related to this PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.8-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

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.

6 participants