Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix modal scrolling performance on mobile #3343

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

tim-smart
Copy link
Contributor

This is primarily done by removing the blur effect from the overlay, and
replacing it will a translucent black.

The blur effect performs poorly on mobile devices.

@actual-github-bot actual-github-bot bot changed the title fix modal scrolling performance on mobile [WIP] fix modal scrolling performance on mobile Sep 1, 2024
Copy link

netlify bot commented Sep 1, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 7a16693
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6719c1cb7fca880008bcfe41
😎 Deploy Preview https://deploy-preview-3343.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 site configuration.

Copy link
Contributor

github-actions bot commented Sep 1, 2024

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
9 5.32 MB → 5.32 MB (+285 B) +0.01%
Changeset
File Δ Size
src/components/common/Modal.tsx 📈 +249 B (+2.62%) 9.28 kB → 9.53 kB
src/components/autocomplete/CategoryAutocomplete.tsx 📈 +36 B (+0.35%) 10.15 kB → 10.18 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.33 MB → 3.33 MB (+285 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/resize-observer.js 18.37 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/usePreviewTransactions.js 1.64 kB 0%
static/js/AppliedFilters.js 21.3 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 82.57 kB 0%
static/js/wide.js 232.12 kB 0%
static/js/ReportRouter.js 1.5 MB 0%

Copy link
Contributor

github-actions bot commented Sep 1, 2024

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 1.27 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.js 1.27 MB 0%

@tim-smart tim-smart changed the title [WIP] fix modal scrolling performance on mobile fix modal scrolling performance on mobile Sep 2, 2024
@tim-smart tim-smart force-pushed the mobile-scroll branch 2 times, most recently from 041972c to e1ee6ef Compare September 4, 2024 23:21
@youngcw
Copy link
Member

youngcw commented Sep 5, 2024

Can this be more pronounced? Currently its hard to even notice that there is a change at all.

@tim-smart
Copy link
Contributor Author

Can this be more pronounced? Currently its hard to even notice that there is a change at all.

The goal was to make only a small visual difference, but improve the scrolling speed of the category selector menu on mobile.

@joel-jeremy
Copy link
Contributor

Are you using Safari by any chance? I remember implementing something on the PrivacyFilter to fix slow blur performance:
image

@tim-smart
Copy link
Contributor Author

Android / chrome. I tried the forcing gpu rendering trick, but it didn't have any effect. The difference here is that it was using backdrop-filter.

Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Walkthrough

The pull request introduces modifications to two components: Modal.tsx and CategoryAutocomplete.tsx. In Modal.tsx, a new import for useResponsive has been added to manage styling based on viewport width, specifically replacing the backdropFilter with a backgroundColor for narrow widths. The ModalContentContainer component now conditionally applies display: 'none' based on the noAnimation and isActive props, while the ModalButtons component includes a new focusButton prop to enhance accessibility by focusing the first visible button upon mounting. In CategoryAutocomplete.tsx, the CategoryList component's styling has been updated, including a change from overflow: 'auto' to overflowY: 'auto', and the addition of willChange: 'transform'. The rendering logic for items has been refined to ensure proper display of group headers and improved filtering in the filterSuggestions function. Type signatures for props have also been updated for clarity. These changes collectively enhance the functionality, styling, and accessibility of the affected components.

Possibly related PRs

  • fix modals on mobile BudgetTable #3487: This PR addresses modal functionality on mobile devices, which is relevant to the changes made in the Modal component in the main PR, particularly regarding mobile responsiveness and modal behavior.
  • Fix mobile balance modal colors #3492: This PR modifies the BalanceWithCarryover component, which is related to modal functionality as it updates how properties are passed to modals, including the isDisabled prop, aligning with the accessibility enhancements in the main PR.
  • make BudgetTable Budgeted value positive on mobile #3602: This PR focuses on the BudgetTable component, which is relevant as it involves adjustments to how values are displayed, similar to the responsive design and visual styling changes made in the Modal component of the main PR.

Suggested labels

<sparkles: Merged>

Suggested reviewers

  • youngcw
  • joel-jeremy

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f37c7e4 and 7a16693.

⛔ Files ignored due to path filters (43)
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--14404-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--321fd-ed-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--4bb70-ed-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--6ab37-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a79-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a85-ed-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--9e6aa-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bbde3-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bed18-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--ceb3a-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--d270d-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--fdd57-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--0ba04-nt-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--1ce6d-nt-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--42062-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--49fb6-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--5f098-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--929be-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a3783-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a8b5e-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--b1562-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--dc927-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f224f-nt-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f8a19-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • upcoming-release-notes/3343.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Modal.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/common/Modal.tsx (1)
Learnt from: tim-smart
PR: actualbudget/actual#3343
File: packages/desktop-client/src/components/common/Modal.tsx:86-86
Timestamp: 2024-10-13T23:24:09.179Z
Learning: In `packages/desktop-client/src/components/common/Modal.tsx`, setting `willChange: 'transform'` forces the browser to render the layer with GPU acceleration, improving performance.
🔇 Additional comments (3)
packages/desktop-client/src/components/common/Modal.tsx (3)

25-25: LGTM: Responsive handling implementation

The addition of useResponsive hook and its usage to detect narrow width devices is well-implemented, providing a clean way to apply mobile-specific optimizations.

Also applies to: 56-56


87-87: LGTM: GPU acceleration optimization

The addition of willChange: 'transform' is a good optimization that forces GPU acceleration for the modal layer, potentially improving rendering performance.


88-95: LGTM: Effective mobile performance optimization

The conditional styling effectively addresses mobile performance by:

  1. Removing the computationally expensive backdropFilter on narrow width devices
  2. Replacing it with a lightweight rgba background
  3. Maintaining the blur effect only on wider screens where performance impact is less significant

This change directly addresses the scrolling performance issues on mobile devices while maintaining a good visual experience across all platforms.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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
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

🧹 Outside diff range and nitpick comments (5)
packages/desktop-client/src/components/common/Modal.tsx (1)

Line range hint 238-258: Improved modal button accessibility

The addition of the focusButton prop and its implementation in the ModalButtons component is a great accessibility enhancement. It allows for automatic focus on the first visible button when the modal opens, which is particularly useful for keyboard navigation.

Consider adding a brief comment explaining the purpose of the focusButton prop for better code documentation. For example:

// focusButton: When true, automatically focuses the first visible button in the modal
focusButton?: boolean;
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (4)

90-91: Approved: Style changes improve scrolling performance

The changes to the View component's style enhance the scrolling behavior and potentially improve rendering performance:

  1. Changing overflow: 'auto' to overflowY: 'auto' is more specific and allows horizontal content to remain visible if needed.
  2. Adding willChange: 'transform' can improve performance for transform animations.

These modifications align well with the PR objective of enhancing scrolling performance on mobile devices.

Consider wrapping the willChange property in a condition that checks if the device is mobile, as this optimization is primarily beneficial for mobile devices and might cause unnecessary memory consumption on desktop browsers:

style={{
  overflowY: 'auto',
  ...(isMobileDevice && { willChange: 'transform' }),
  // ... other styles
}}

This approach ensures that the optimization is applied only when necessary.


Line range hint 265-286: Approved: Enhanced filtering logic improves autocomplete accuracy

The changes to the filterSuggestions function significantly improve the autocomplete functionality:

  1. The function now considers both category names and group names when filtering suggestions.
  2. The use of getNormalisedString ensures case-insensitive and accent-insensitive comparisons.

These enhancements align well with the PR objective of improving the category selector functionality.

Consider extracting the normalization and comparison logic into a separate helper function to improve readability and maintainability:

const normalizedIncludes = (text: string, search: string) =>
  getNormalisedString(text).includes(getNormalisedString(search));

// Then use it in the filter function:
return suggestions
  .filter(suggestion => {
    if (suggestion.id === 'split') {
      return true;
    }

    if (suggestion.group) {
      return (
        normalizedIncludes(suggestion.group.name, value) ||
        normalizedIncludes(`${suggestion.group.name} ${suggestion.name}`, value)
      );
    }

    return defaultFilterSuggestion(suggestion, value);
  })
  // ... rest of the function

This refactoring would make the code more readable and easier to maintain.


Line range hint 420-468: Approved: Enhanced CategoryItem with balance display

The changes to the CategoryItem component significantly improve its functionality:

  1. The component now displays balance information, enhancing the user experience.
  2. It uses React hooks (useSyncedPref, useSheetValue) to efficiently manage state and side effects.
  3. The balance display is conditionally rendered based on the showBalances prop, providing flexibility.

While these changes are not directly related to the PR's main objective of improving scrolling performance, they do enhance the overall functionality of the category selector.

Consider extracting the balance calculation logic into a custom hook to improve code organization and reusability:

function useItemBalance(item: CategoryAutocompleteItem) {
  const [budgetType = 'rollover'] = useSyncedPref('budgetType');
  const balanceBinding =
    budgetType === 'rollover'
      ? envelopeBudget.catBalance(item.id)
      : trackingBudget.catBalance(item.id);
  return useSheetValue<
    'envelope-budget' | 'tracking-budget',
    typeof balanceBinding
  >(balanceBinding);
}

// Then in the CategoryItem component:
const balance = useItemBalance(item);

This refactoring would make the CategoryItem component more focused and easier to maintain.


Line range hint 1-468: Overall Assessment: Excellent improvements to CategoryAutocomplete

This PR introduces several valuable enhancements to the CategoryAutocomplete component and its related functions:

  1. Improved scrolling performance through style optimizations in the CategoryList component.
  2. Enhanced filtering logic in the filterSuggestions function, improving autocomplete accuracy.
  3. Added balance display functionality to the CategoryItem component, enriching the user interface.

These changes align well with the PR objectives and contribute to an improved user experience, especially on mobile devices. The code quality is high, with good use of React hooks and TypeScript types.

To further improve the component's architecture and maintainability:

  1. Consider breaking down the CategoryAutocomplete.tsx file into smaller, more focused components. This could improve readability and make the codebase easier to navigate.
  2. Implement proper error handling for the useSheetValue hook calls to gracefully handle potential data fetching issues.
  3. Add unit tests for the new filtering logic and balance display functionality to ensure long-term reliability.

These architectural improvements would complement the excellent work done in this PR and contribute to the overall robustness of the application.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bdeb194 and 47b27d4.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3343.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Modal.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
packages/desktop-client/src/components/common/Modal.tsx (3)

84-85: Improved modal overlay performance

The changes to the ReactAriaModalOverlay component align well with the PR objectives. Replacing the backdropFilter with a semi-transparent background color and adding willChange: 'transform' should significantly improve scrolling performance on mobile devices, especially for the category selector menu.


Line range hint 1-532: Summary of Modal.tsx changes

The changes in this file successfully address the PR objectives:

  1. Improved scrolling performance by replacing the blur effect with a translucent background.
  2. Enhanced rendering logic for better performance.
  3. Improved accessibility with the new focusButton prop.

These modifications should result in a more efficient and user-friendly modal component, especially on mobile devices. The changes are well-implemented and align with best practices for performance and accessibility.


Line range hint 232-235: Enhanced modal content rendering logic

The addition of conditional styling to hide the modal content when noAnimation is true and isActive is false is a good optimization. This should improve performance by not rendering unnecessary content.

To ensure this change doesn't introduce any unexpected behavior or accessibility issues, please verify:

  1. The modal still functions correctly in all scenarios (with and without animation, active and inactive states).
  2. Screen readers and other assistive technologies can still interact with the modal content appropriately.

You can use the following script to check for potential issues:

✅ Verification successful

Accessibility Concerns Verified

The Modal.tsx component includes necessary aria attributes and role declarations, ensuring proper accessibility support. Additionally, there are no pending accessibility-related TODOs or FIXMEs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential accessibility issues with the new modal rendering logic

# Test: Search for aria attributes and roles related to the modal
rg --type typescript 'aria-|role=' packages/desktop-client/src/components/common/Modal.tsx

# Test: Check if there are any comments or TODOs related to accessibility
rg --type typescript '// TODO.*accessibility|// FIXME.*accessibility' packages/desktop-client/src/components/common/Modal.tsx

Length of output: 290


Script:

#!/bin/bash
# Description: Check for potential accessibility issues with the new modal rendering logic without using unsupported file types

# Test: Search for aria attributes and roles related to the modal
rg 'aria-|role=' packages/desktop-client/src/components/common/Modal.tsx

# Test: Check if there are any comments or TODOs related to accessibility
rg '// TODO.*accessibility|// FIXME.*accessibility' packages/desktop-client/src/components/common/Modal.tsx

Length of output: 338

@tim-smart tim-smart force-pushed the mobile-scroll branch 3 times, most recently from feebe50 to c3fe81d Compare October 10, 2024 22:33
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

🧹 Outside diff range and nitpick comments (2)
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (2)

90-91: Approved: Style changes for improved scrolling performance

The changes to overflowY: 'auto' and the addition of willChange: 'transform' are good optimizations for improving scrolling performance, especially on mobile devices. This aligns well with the PR's objective.

However, be cautious with willChange: 'transform' as it can increase memory consumption. Consider adding it dynamically only when scrolling starts and removing it when scrolling ends for optimal performance.

You might want to consider implementing a scroll listener to dynamically add and remove the willChange property:

const [isScrolling, setIsScrolling] = useState(false);

const handleScroll = useCallback(() => {
  setIsScrolling(true);
  clearTimeout(scrollTimer.current);
  scrollTimer.current = setTimeout(() => setIsScrolling(false), 150);
}, []);

// In the View style
willChange: isScrolling ? 'transform' : 'auto',

// Add onScroll prop to View
onScroll={handleScroll}

This approach can further optimize performance by only applying willChange when necessary.


Line range hint 391-394: Approved: Addition of default render functions

The addition of defaultRenderCategoryItemGroupHeader and defaultRenderCategoryItem functions is a great improvement to the component's flexibility. These default implementations allow for easy customization of rendering logic when needed, while providing sensible defaults.

Consider adding prop types for the custom render functions in the CategoryAutocompleteProps interface to improve type safety:

type CategoryAutocompleteProps = {
  // ... existing props
  renderCategoryItemGroupHeader?: typeof defaultRenderCategoryItemGroupHeader;
  renderCategoryItem?: typeof defaultRenderCategoryItem;
};

This change would ensure that any custom render functions provided must match the signature of the default functions, preventing potential runtime errors.

Also applies to: 449-452

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between feebe50 and c3fe81d.

⛔ Files ignored due to path filters (52)
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--14404-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--321fd-ed-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--4bb70-ed-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--6ab37-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a79-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a85-ed-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--9e6aa-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bbde3-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bed18-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--ceb3a-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--d270d-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--fdd57-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--0ba04-nt-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--1ce6d-nt-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--42062-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--49fb6-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--5f098-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--929be-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a3783-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a8b5e-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--b1562-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--dc927-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f224f-nt-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f8a19-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • upcoming-release-notes/3343.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Modal.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/desktop-client/src/components/common/Modal.tsx
🧰 Additional context used
🔇 Additional comments (2)
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (2)

Line range hint 252-270: Approved: Enhanced filtering logic for better autocomplete suggestions

The updates to the filterSuggestions function are well-implemented and improve the accuracy of autocomplete suggestions. By considering both category and group names in the filtering process, users will have a better experience finding the categories they need.

The implementation is efficient and correctly handles the 'split' suggestion as a special case. The use of getNormalisedString ensures consistent comparison regardless of string variations.


Line range hint 1-452: Summary: Effective improvements to CategoryAutocomplete component

Overall, the changes made to CategoryAutocomplete.tsx are well-implemented and align closely with the PR objectives. The key improvements include:

  1. Enhanced scrolling performance for mobile devices.
  2. Improved autocomplete suggestion filtering.
  3. Increased component flexibility with default render functions.

These changes collectively contribute to a better user experience, especially on mobile platforms. The code quality is high, and the implementations follow React best practices.

A few minor suggestions have been made for further optimization and type safety, but these are not critical for the current implementation.

@tim-smart
Copy link
Contributor Author

tim-smart commented Oct 11, 2024

Here is some videos showing the difference:

telegram-cloud-document-1-5496892831265980427.mp4
telegram-cloud-document-1-5496892831265980426.mp4

Copy link
Contributor

@MikesGlitch MikesGlitch left a comment

Choose a reason for hiding this comment

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

I can confirm on Mobile Chrome and Edge there's a slight performance improvement.

We lose the blur though and there's not a lot of contrast with some other elements on the desktop screen, particularly in dark mode.

E.g.
image

What are peoples thoughts on if the style was only applied to mobile?

@tim-smart
Copy link
Contributor Author

I think mobile only is a good option.

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: 1

🧹 Outside diff range and nitpick comments (2)
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (2)

Line range hint 116-117: Improved group header rendering and clarity

The updates to the group header rendering logic are beneficial:

  1. The new groupName variable clearly indicates hidden groups with a "(hidden)" label.
  2. The simplified showGroup condition improves code readability.

These changes enhance the user experience by providing more information about hidden groups.

Consider using a template literal for groupName for better readability:

const groupName = `${item.group?.name}${item.group?.hidden ? ` ${t('(hidden)')}` : ''}`;

Line range hint 270-290: Enhanced filtering logic for improved autocomplete suggestions

The updates to the filterSuggestions function significantly improve the autocomplete functionality:

  1. The function now considers both category and group names when filtering suggestions.
  2. The use of getNormalisedString ensures consistent string comparison, improving matching accuracy.

These changes will make it easier for users to find categories, especially when they remember the group name but not the exact category name.

Consider a small optimization to reduce redundant normalization:

const normalizedValue = getNormalisedString(value);
return suggestions
  .filter(suggestion => {
    if (suggestion.id === 'split') {
      return true;
    }

    const normalizedName = getNormalisedString(suggestion.name);
    if (suggestion.group) {
      const normalizedGroupName = getNormalisedString(suggestion.group.name);
      return normalizedGroupName.includes(normalizedValue) ||
             `${normalizedGroupName} ${normalizedName}`.includes(normalizedValue);
    }

    return normalizedName.includes(normalizedValue);
  })
  .sort((a, b) => customSort(a, normalizedValue) - customSort(b, normalizedValue));

This optimization reduces the number of times getNormalisedString is called, potentially improving performance for large lists of suggestions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c3fe81d and 44633fb.

⛔ Files ignored due to path filters (52)
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-import-csv-file-twice-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-Import-Transactions-imports-transactions-from-a-CSV-file-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--14404-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--321fd-ed-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--4bb70-ed-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--6ab37-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a79-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--94a85-ed-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--9e6aa-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bbde3-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--bed18-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--ceb3a-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--d270d-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking--fdd57-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Envelope-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--0ba04-nt-amount-opens-the-budget-summary-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--1ce6d-nt-amount-opens-the-budget-summary-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--42062-in-the-page-header-opens-the-month-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--49fb6-in-the-page-header-opens-the-month-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--5f098-roup-name-opens-the-category-group-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--929be-roup-name-opens-the-category-group-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a3783-in-the-page-header-opens-the-budget-page-menu-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--a8b5e-in-the-page-header-opens-the-budget-page-menu-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--b1562-in-the-page-header-opens-the-month-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--dc927-roup-name-opens-the-category-group-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f224f-nt-amount-opens-the-budget-summary-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking--f8a19-in-the-page-header-opens-the-budget-page-menu-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-balance-cell-opens-the-balance-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-budgeted-cell-opens-the-budget-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/budget.mobile.test.js-snapshots/Mobile-Budget-Tracking-checks-that-clicking-the-category-name-opens-the-category-menu-modal-3-chromium-linux.png is excluded by !**/*.png
  • upcoming-release-notes/3343.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Modal.tsx (3 hunks)
🧰 Additional context used
🔇 Additional comments (5)
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (2)

90-91: Improved scrolling performance and rendering optimization

The changes to the View component's style properties are beneficial:

  1. Changing overflow: 'auto' to overflowY: 'auto' allows for more precise control over vertical scrolling while ensuring horizontal content remains fully visible.
  2. Adding willChange: 'transform' is a performance optimization hint for browsers, potentially improving rendering performance for animations or transitions.

These modifications should enhance the scrolling experience and overall performance of the CategoryList component.


Line range hint 1-524: Overall assessment: Significant improvements to CategoryAutocomplete component

The changes made to the CategoryAutocomplete component and its related functions bring several notable improvements:

  1. Enhanced scrolling performance and rendering optimization in the CategoryList component.
  2. Improved clarity in group header rendering, especially for hidden groups.
  3. More accurate and user-friendly autocomplete suggestions by considering both category and group names in the filtering logic.

These modifications collectively contribute to a better user experience, improved performance, and more intuitive functionality. The code changes are well-structured and maintain good coding practices.

While some minor optimizations were suggested, the overall quality of the changes is high, and they successfully address the goal of improving the category selector menu's performance and usability.

packages/desktop-client/src/components/common/Modal.tsx (3)

24-24: Importing useResponsive for responsive design

The import of useResponsive from '../../ResponsiveProvider' is correctly added to enable responsive styling based on the viewport size.


55-55: Utilizing isNarrowWidth for conditional styling

Destructuring isNarrowWidth from useResponsive() allows the component to adjust styles conditionally, enhancing the user experience on different devices.


86-94: Conditional styles improve mobile performance

Applying conditional styles to ReactAriaModalOverlay based on isNarrowWidth effectively replaces the backdropFilter with a translucent background color on mobile devices. This addresses performance issues associated with the blur effect on mobile platforms.

@youngcw youngcw added this to the v24.11.0 milestone Oct 15, 2024
@MikesGlitch MikesGlitch self-assigned this Oct 15, 2024
Copy link
Contributor

@MikesGlitch MikesGlitch left a comment

Choose a reason for hiding this comment

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

Gotta say I think the blur is doing good work on these screens, without it it makes the menu's look clickable:

image

Are we sure there's no way to keep the blur but improve the performance? I'm finding it difficult to decide if it's worth losing the blur for the tiny perf improvement.

@joel-jeremy
Copy link
Contributor

Would translate: 'translateZ(0)' help in addition to the willChange prop?

@tim-smart
Copy link
Contributor Author

Would translate: 'translateZ(0)' help in addition to the willChange prop?

No it doesn't help here.

@tim-smart
Copy link
Contributor Author

Are we sure there's no way to keep the blur but improve the performance? I'm finding it difficult to decide if it's worth losing the blur for the tiny perf improvement.

I think it depends on your gpu. I'm using a Pixel 5 and it is quite painful to use the category selector - really choppy and hard to get to the bottom with lots of categories.

@youngcw
Copy link
Member

youngcw commented Oct 22, 2024

I would think that increasing the darkening effect would probably work to be more obvious. You could potentially modify the theme files to have darkening that is theme dependent.

This is primarily done by removing the blur effect from the overlay, and
replacing it will a translucent black.

The blur effect performs poorly on mobile devices.
Copy link
Contributor

@MikesGlitch MikesGlitch left a comment

Choose a reason for hiding this comment

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

Making it darker helps! :shipit: Will wait for a second review since others have commented.

Copy link
Member

@youngcw youngcw left a comment

Choose a reason for hiding this comment

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

Looks good!

@youngcw youngcw merged commit fbb0f9b into actualbudget:master Oct 24, 2024
20 checks passed
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.

4 participants