Skip to content

Conversation

jfdoming
Copy link
Member

@jfdoming jfdoming commented Aug 21, 2025

No description provided.

Copy link

netlify bot commented Aug 21, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 95a931a
🔍 Latest deploy log https://app.netlify.com/projects/actualbudget/deploys/68abe8ea3d13720008b3a4c2
😎 Deploy Preview https://deploy-preview-5595.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented Aug 21, 2025

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
23 10.75 MB → 10.76 MB (+7.1 kB) +0.06%
Changeset
File Δ Size
src/components/NavigableFocusProvider.tsx 🆕 +2.07 kB 0 B → 2.07 kB
src/components/mobile/transactions/AddTransactionButton.tsx 📈 +108 B (+19.78%) 546 B → 654 B
src/components/mobile/transactions/FocusableAmountInput.tsx 📈 +784 B (+12.71%) 6.02 kB → 6.79 kB
src/index.tsx 📈 +91 B (+7.79%) 1.14 kB → 1.23 kB
src/components/mobile/MobileNavTabs.tsx 📈 +180 B (+3.24%) 5.43 kB → 5.6 kB
locale/de.json 📈 +2.18 kB (+1.56%) 140.13 kB → 142.32 kB
locale/fr.json 📈 +825 B (+0.54%) 149.26 kB → 150.07 kB
locale/uk.json 📈 +893 B (+0.47%) 185.02 kB → 185.9 kB
locale/es.json 📈 +59 B (+0.08%) 71.41 kB → 71.47 kB
src/components/mobile/transactions/TransactionEdit.jsx 📉 -22 B (-0.06%) 36.1 kB → 36.08 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 7.83 MB → 7.83 MB (+3.08 kB) +0.04%
static/js/de.js 140.13 kB → 142.32 kB (+2.18 kB) +1.56%
static/js/uk.js 185.02 kB → 185.9 kB (+893 B) +0.47%
static/js/fr.js 149.26 kB → 150.07 kB (+825 B) +0.54%
static/js/narrow.js 450.92 kB → 451.02 kB (+108 B) +0.02%
static/js/es.js 71.41 kB → 71.47 kB (+59 B) +0.08%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/en-GB.js 6.84 kB 0%
static/js/en.js 128.77 kB 0%
static/js/it.js 142.04 kB 0%
static/js/nl.js 99.98 kB 0%
static/js/pl.js 86.07 kB 0%
static/js/pt-BR.js 141.84 kB 0%
static/js/sv.js 67.43 kB 0%
static/js/th.js 188.74 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/ReportRouter.js 830.05 kB 0%
static/js/TransactionList.js 10.92 kB 0%
static/js/wide.js 116.99 kB 0%
static/js/useAccountPreviewTransactions.js 8.52 kB 0%
static/js/useTransactionBatchActions.js 10.22 kB 0%

Copy link
Contributor

github-actions bot commented Aug 21, 2025

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 4.28 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.qbdvDTe8.js 4.28 MB 0%

@jfdoming jfdoming force-pushed the jfdoming/08-21-auto-focus-on-navigate-in-all-browsers branch 5 times, most recently from e73774a to 7b7d0fd Compare August 21, 2025 13:54
@jfdoming jfdoming marked this pull request as ready for review August 21, 2025 14:04
@jfdoming jfdoming requested a review from joel-jeremy as a code owner August 21, 2025 14:04
@jfdoming jfdoming requested a review from matt-fidd August 21, 2025 14:04
@jfdoming jfdoming force-pushed the jfdoming/08-21-auto-focus-on-navigate-in-all-browsers branch from 7b7d0fd to ff7fb95 Compare August 21, 2025 14:09
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Walkthrough

Adds a global hidden input focus mechanism and integrates it into mobile navigation and transaction entry. Introduces NavigableFocusProvider with hooks, wraps the app with the provider, and calls the focus function from MobileNavTabs and AddTransactionButton (decimal inputmode) before navigation. Enhances FocusableAmountInput to coordinate with the global focus element, moves input/blur/keyup handling to effects and useEventCallback, and adjusts TransactionEdit to always trigger initial amount edit on add. E2E: adds globalAmountField locator to the MobileTransactionEntryPage and updates multiple mobile transaction tests to assert focus and fill that field.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • joel-jeremy
  • matt-fidd

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jfdoming/08-21-auto-focus-on-navigate-in-all-browsers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member

@matt-fidd matt-fidd left a comment

Choose a reason for hiding this comment

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

Nice! Tested on iPhone and works as expected.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx (1)

137-158: Address TypeScript errors with proper event listener typing.

The effect correctly manages global input event listeners, but the TypeScript errors should be resolved with proper typing instead of suppressing them.

Consider replacing the type suppressions with proper typing:

-      // @ts-expect-error addEventListener missing types
-      el.addEventListener('blur', onBlur);
-      // @ts-expect-error addEventListener missing types
-      el.addEventListener('input', onChangeText);
-      // @ts-expect-error addEventListener missing types
-      el.addEventListener('keyup', onKeyUp);
+      el.addEventListener('blur', onBlur as EventListener);
+      el.addEventListener('input', onChangeText as EventListener);
+      el.addEventListener('keyup', onKeyUp as EventListener);

And similarly for the cleanup:

-        // @ts-expect-error addEventListener missing types
-        el.removeEventListener('blur', onBlur);
-        // @ts-expect-error addEventListener missing types
-        el.removeEventListener('input', onChangeText);
-        // @ts-expect-error addEventListener missing types
-        el.removeEventListener('keyup', onKeyUp);
+        el.removeEventListener('blur', onBlur as EventListener);
+        el.removeEventListener('input', onChangeText as EventListener);
+        el.removeEventListener('keyup', onKeyUp as EventListener);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7b7d0fd and ff7fb95.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/5595.md is excluded by !**/*.md
📒 Files selected for processing (8)
  • packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.ts (2 hunks)
  • packages/desktop-client/e2e/transactions.mobile.test.ts (4 hunks)
  • packages/desktop-client/src/components/NavigableFocusProvider.tsx (1 hunks)
  • packages/desktop-client/src/components/mobile/MobileNavTabs.tsx (4 hunks)
  • packages/desktop-client/src/components/mobile/transactions/AddTransactionButton.tsx (2 hunks)
  • packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx (5 hunks)
  • packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx (2 hunks)
  • packages/desktop-client/src/index.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/desktop-client/src/components/mobile/MobileNavTabs.tsx
  • packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
  • packages/desktop-client/e2e/transactions.mobile.test.ts
  • packages/desktop-client/src/components/mobile/transactions/AddTransactionButton.tsx
  • packages/desktop-client/src/components/NavigableFocusProvider.tsx
  • packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.ts
  • packages/desktop-client/src/index.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Write concise, technical TypeScript code
Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication
Use descriptive variable names with auxiliary verbs (e.g., isLoaded, hasError)
Structure files with sections in order: exported page/component, GraphQL queries, helpers, static content, types
Favor named exports for components and utilities
Prefer interfaces over types in TypeScript
Avoid enums; use objects or maps instead
Avoid using any or unknown unless absolutely necessary; prefer existing types
Avoid type assertions with as or non-null !; prefer satisfies
Use the function keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements

Files:

  • packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

Use declarative JSX, keeping JSX minimal and readable

Files:

  • packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx
🧠 Learnings (2)
📚 Learning: 2024-10-24T18:57:16.406Z
Learnt from: lelemm
PR: actualbudget/actual#3732
File: packages/desktop-client/src/components/util/AmountInput.tsx:102-108
Timestamp: 2024-10-24T18:57:16.406Z
Learning: In `packages/desktop-client/src/components/util/AmountInput.tsx`, zero amounts are handled in the `onSwitch` function, so zero amounts are intentionally ignored in the `fireUpdate` function.

Applied to files:

  • packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx
📚 Learning: 2024-10-22T05:34:56.976Z
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx:261-277
Timestamp: 2024-10-22T05:34:56.976Z
Learning: In React components (TypeScript), avoid using hooks like `useCallback` inside callbacks or nested functions. Hooks must be called at the top level of functional components.

Applied to files:

  • packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx
🧬 Code graph analysis (1)
packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx (2)
packages/desktop-client/src/components/NavigableFocusProvider.tsx (1)
  • useNavigableFocusRef (85-93)
packages/loot-core/src/shared/util.ts (3)
  • currencyToAmount (444-464)
  • reapplyThousandSeparators (217-238)
  • appendDecimals (240-256)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Functional
  • GitHub Check: Visual regression
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)
🔇 Additional comments (8)
packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx (8)

10-10: LGTM: Import additions align with enhanced focus management.

The new imports (ChangeEvent, useEventCallback, useNavigableFocusRef) are appropriate for the enhanced focus coordination with the global focus manager and proper TypeScript event handling.

Also applies to: 18-18, 28-28


65-66: LGTM: Global focus reference integration.

The integration with the global focus system is clean and follows the established pattern from the NavigableFocusProvider.


67-75: LGTM: Enhanced focus management with global coordination.

The focus logic correctly checks if the global focus element is active before attempting to focus the local input, providing seamless coordination between the global and local focus systems.


83-94: LGTM: Event handler modernization with useEventCallback.

The conversion to useEventCallback is appropriate for performance optimization. The logic for Backspace and Enter key handling is preserved correctly.


100-100: LGTM: Global focus cleanup on text application.

Blurring the global focus element when applying text ensures consistent state management between the global and local focus systems.


121-126: LGTM: onBlur handler modernization.

The conversion to useEventCallback is appropriate, and the existing blur logic with default prevention check is preserved correctly.


128-135: LGTM: Properly typed onChange handler.

The conversion to a properly typed ChangeEvent<HTMLInputElement> handler with useEventCallback is excellent. The logic for text processing with thousand separators and decimals is preserved correctly.


167-167: LGTM: Direct event handler assignment.

The change from value-callback form to direct onChangeText assignment is consistent with the modernized event handling approach.

@jfdoming
Copy link
Member Author

Nice! Tested on iPhone and works as expected.

Awesome! I think the VRT is flaky now 😞 got it "working," pushed a cosmetic change and it broke again. I'll have a look when I'm back but if you have any ideas ff to push to my branch

@youngcw
Copy link
Member

youngcw commented Aug 22, 2025

Would it be possible to not auto-focus the amount if its an existing transaction? So if you open a transaction from the account page, it would be nice to not focus the amount where usually I want to make something as cleared or change the category in that case

@jfdoming
Copy link
Member Author

Would it be possible to not auto-focus the amount if its an existing transaction? So if you open a transaction from the account page, it would be nice to not focus the amount where usually I want to make something as cleared or change the category in that case

Just to clarify, you're requesting for a behavioral change vs master, right? On Android 25.8 it currently auto-focuses even on edit

@youngcw
Copy link
Member

youngcw commented Aug 22, 2025

Would it be possible to not auto-focus the amount if its an existing transaction? So if you open a transaction from the account page, it would be nice to not focus the amount where usually I want to make something as cleared or change the category in that case

Just to clarify, you're requesting for a behavioral change vs master, right? On Android 25.8 it currently auto-focuses even on edit

Correct. The current behavior feels sub-optimal. It seems best to NOT auto-focus whrn viewing existing transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants