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 React Aria Button hover styles #3453

Merged
merged 4 commits into from
Sep 19, 2024
Merged

Conversation

joel-jeremy
Copy link
Contributor

@joel-jeremy joel-jeremy commented Sep 16, 2024

Resolves #3447

Preferring to use className instead of the inline style syntax to allow for easier CSS library migration in the future

@actual-github-bot actual-github-bot bot changed the title Fiox hover styles and use className instead of inline to prepare for … [WIP] Fiox hover styles and use className instead of inline to prepare for … Sep 16, 2024
Copy link

netlify bot commented Sep 16, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit b973147
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66ebcd82136568000875c16d
😎 Deploy Preview https://deploy-preview-3453.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.

@joel-jeremy joel-jeremy changed the title [WIP] Fiox hover styles and use className instead of inline to prepare for … Fix React Aria Button hover styles Sep 16, 2024
Copy link
Contributor

github-actions bot commented Sep 16, 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.29 MB → 5.28 MB (-3.39 kB) -0.06%
Changeset
File Δ Size
src/components/common/Link.tsx 📈 +23 B (+0.88%) 2.55 kB → 2.58 kB
src/components/settings/Themes.tsx 📈 +6 B (+0.26%) 2.28 kB → 2.29 kB
src/components/transactions/TransactionsTable.jsx 📉 -3 B (-0.00%) 63.34 kB → 63.34 kB
src/components/modals/ImportTransactionsModal.jsx 📉 -13 B (-0.02%) 52.26 kB → 52.25 kB
src/components/mobile/budget/BudgetTable.jsx 📉 -36 B (-0.07%) 52.22 kB → 52.19 kB
src/components/select/RecurringSchedulePicker.tsx 📉 -18 B (-0.11%) 16.25 kB → 16.24 kB
src/components/reports/Header.tsx 📉 -6 B (-0.12%) 4.93 kB → 4.93 kB
src/components/Notifications.tsx 📉 -10 B (-0.14%) 6.96 kB → 6.95 kB
src/components/modals/RolloverBudgetMonthMenuModal.tsx 📉 -10 B (-0.15%) 6.72 kB → 6.71 kB
src/components/modals/ReportBudgetMonthMenuModal.tsx 📉 -10 B (-0.15%) 6.42 kB → 6.41 kB
src/components/Titlebar.tsx 📉 -15 B (-0.18%) 7.98 kB → 7.97 kB
src/components/mobile/MobileBackButton.tsx 📉 -3 B (-0.30%) 984 B → 981 B
src/components/settings/Format.tsx 📉 -18 B (-0.39%) 4.5 kB → 4.48 kB
src/components/common/Button2.tsx 📉 -28 B (-0.51%) 5.31 kB → 5.28 kB
home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts 📉 -73 B (-1.10%) 6.48 kB → 6.41 kB
src/components/modals/EditRuleModal.jsx 📉 -1.61 kB (-4.14%) 38.94 kB → 37.33 kB
src/components/settings/Experimental.tsx 📉 -233 B (-5.13%) 4.44 kB → 4.21 kB
src/components/common/Select.tsx 📉 -143 B (-5.50%) 2.54 kB → 2.4 kB
src/hooks/useFeatureFlag.ts 📉 -27 B (-7.78%) 347 B → 320 B
src/components/rules/ActionExpression.tsx 📉 -375 B (-9.12%) 4.01 kB → 3.65 kB
src/icons/v1/Code.tsx 🔥 -448 B (-100%) 448 B → 0 B
src/icons/v1/AlignLeft.tsx 🔥 -387 B (-100%) 387 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/index.js 3.31 MB → 3.31 MB (-3.35 kB) -0.10%
static/js/narrow.js 80.95 kB → 80.92 kB (-36 B) -0.04%
static/js/ReportRouter.js 1.5 MB → 1.5 MB (-6 B) -0.00%
static/js/wide.js 225.37 kB → 225.37 kB (-3 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/usePreviewTransactions.js 1.59 kB 0%
static/js/AppliedFilters.js 20.97 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%

Copy link
Contributor

github-actions bot commented Sep 16, 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.26 MB → 1.19 MB (-74.56 kB) -5.76%
Changeset
File Δ Size
packages/loot-core/src/shared/rules.ts 📉 -83 B (-0.92%) 8.8 kB → 8.72 kB
packages/loot-core/src/server/accounts/rules.ts 📉 -2.85 kB (-8.45%) 33.74 kB → 30.88 kB
node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js 🔥 -200.84 kB (-100%) 200.84 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js 🔥 -118.53 kB (-100%) 118.53 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js 🔥 -56.75 kB (-100%) 56.75 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/runtime.js 🔥 -43.72 kB (-100%) 43.72 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js 🔥 -22.62 kB (-100%) 22.62 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js 🔥 -18.76 kB (-100%) 18.76 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js 🔥 -15.51 kB (-100%) 15.51 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js 🔥 -12.33 kB (-100%) 12.33 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/utils.js 🔥 -10.07 kB (-100%) 10.07 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/each.js 🔥 -9.64 kB (-100%) 9.64 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/base.js 🔥 -9.41 kB (-100%) 9.41 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js 🔥 -8.29 kB (-100%) 8.29 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/exception.js 🔥 -5.81 kB (-100%) 5.81 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars.js 🔥 -4.79 kB (-100%) 4.79 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars.runtime.js 🔥 -4.5 kB (-100%) 4.5 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/if.js 🔥 -4.35 kB (-100%) 4.35 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/base.js 🔥 -3.83 kB (-100%) 3.83 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers.js 🔥 -3.82 kB (-100%) 3.82 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/logger.js 🔥 -3.79 kB (-100%) 3.79 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js 🔥 -3.74 kB (-100%) 3.74 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/with.js 🔥 -3.67 kB (-100%) 3.67 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js 🔥 -3.34 kB (-100%) 3.34 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js 🔥 -2.63 kB (-100%) 2.63 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/log.js 🔥 -2.45 kB (-100%) 2.45 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/no-conflict.js 🔥 -2.45 kB (-100%) 2.45 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js 🔥 -2.14 kB (-100%) 2.14 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js 🔥 -1.97 kB (-100%) 1.97 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js 🔥 -1.74 kB (-100%) 1.74 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js 🔥 -1.21 kB (-100%) 1.21 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/safe-string.js 🔥 -1.14 kB (-100%) 1.14 kB → 0 B
node_modules/handlebars/dist/cjs/handlebars/decorators.js 🔥 -1000 B (-100%) 1000 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
kcab.worker.js 1.26 MB → 1.19 MB (-74.56 kB) -5.76%

Unchanged

No assets were unchanged

Copy link
Contributor

@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.

I've double checked as best I can but this doesn't seem to replicate the behaviour in demo (which is a little odd anyway IMO)

Just going off the report in #3447 I was testing the payee selector in the rules creation modal

On edge: as described in the bug
On demo: no hover effect, grayed out background on click that does not persist
In this change: hover effect changes text colour to black, but click effect isn't there

Can send videos if you can't reproduce but I've cleared cache etc so it should be the same for everyone

@@ -139,6 +139,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
children,
variant = 'normal',
bounce = true,
// style,
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this left in on purpose?

@MikesGlitch
Copy link
Contributor

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Actions performed

Full review triggered.

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

The changes involve a comprehensive refactor of styling across multiple components in the desktop client, transitioning from inline styles to a CSS-in-JS approach using the glamor library. This update enhances the maintainability and readability of the code by centralizing style definitions and utilizing CSS pseudo-classes for hover and active states. The modifications affect various components, including buttons and select elements, ensuring consistent styling practices throughout the application.

Changes

File Path Change Summary
packages/desktop-client/src/components/Notifications.tsx, Titlebar.tsx, common/Button2.tsx, common/Link.tsx, mobile/MobileBackButton.tsx, mobile/budget/BudgetTable.jsx, modals/EditRuleModal.jsx, modals/ImportTransactionsModal.jsx, modals/ReportBudgetMonthMenuModal.tsx, modals/RolloverBudgetMonthMenuModal.tsx, transactions/TransactionsTable.jsx Refactored styling to use CSS-in-JS with glamor, replacing inline styles with class-based styles for better maintainability and readability.
packages/desktop-client/src/components/common/Select.tsx, packages/desktop-client/src/components/modals/EditRuleModal.jsx, packages/desktop-client/src/components/modals/ImportTransactionsModal.jsx, packages/desktop-client/src/components/reports/Header.tsx, packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx, packages/desktop-client/src/components/settings/Format.tsx, packages/desktop-client/src/components/settings/Themes.tsx Changed buttonStyle prop to style in multiple components for consistent styling approach.

Assessment against linked issues

Objective Addressed Explanation
Hover effect on select component should work consistently (#3447)

Possibly related PRs

  • ♻️ (synced-prefs) move budget type to synced prefs #3427: The changes in this PR involve a shift to using synced preferences for managing the budget type, which aligns with the overall theme of improving maintainability and organization in the codebase, similar to the refactoring of styling approaches in the main PR.

Suggested reviewers

  • MikesGlitch
  • joel-jeremy

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b562e5a and b973147.

Files ignored due to path filters (1)
  • upcoming-release-notes/3453.md is excluded by !**/*.md
Files selected for processing (16)
  • packages/desktop-client/src/components/Notifications.tsx (2 hunks)
  • packages/desktop-client/src/components/Titlebar.tsx (2 hunks)
  • packages/desktop-client/src/components/common/Button2.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Link.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Select.tsx (4 hunks)
  • packages/desktop-client/src/components/mobile/MobileBackButton.tsx (2 hunks)
  • packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx (6 hunks)
  • packages/desktop-client/src/components/modals/EditRuleModal.jsx (2 hunks)
  • packages/desktop-client/src/components/modals/ImportTransactionsModal.jsx (1 hunks)
  • packages/desktop-client/src/components/modals/ReportBudgetMonthMenuModal.tsx (2 hunks)
  • packages/desktop-client/src/components/modals/RolloverBudgetMonthMenuModal.tsx (2 hunks)
  • packages/desktop-client/src/components/reports/Header.tsx (1 hunks)
  • packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx (3 hunks)
  • packages/desktop-client/src/components/settings/Format.tsx (3 hunks)
  • packages/desktop-client/src/components/settings/Themes.tsx (2 hunks)
  • packages/desktop-client/src/components/transactions/TransactionsTable.jsx (2 hunks)
Files skipped from review as they are similar to previous changes (16)
  • packages/desktop-client/src/components/Notifications.tsx
  • packages/desktop-client/src/components/Titlebar.tsx
  • packages/desktop-client/src/components/common/Button2.tsx
  • packages/desktop-client/src/components/common/Link.tsx
  • packages/desktop-client/src/components/common/Select.tsx
  • packages/desktop-client/src/components/mobile/MobileBackButton.tsx
  • packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx
  • packages/desktop-client/src/components/modals/EditRuleModal.jsx
  • packages/desktop-client/src/components/modals/ImportTransactionsModal.jsx
  • packages/desktop-client/src/components/modals/ReportBudgetMonthMenuModal.tsx
  • packages/desktop-client/src/components/modals/RolloverBudgetMonthMenuModal.tsx
  • packages/desktop-client/src/components/reports/Header.tsx
  • packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx
  • packages/desktop-client/src/components/settings/Format.tsx
  • packages/desktop-client/src/components/settings/Themes.tsx
  • packages/desktop-client/src/components/transactions/TransactionsTable.jsx

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.

@joel-jeremy
Copy link
Contributor Author

I've double checked as best I can but this doesn't seem to replicate the behaviour in demo (which is a little odd anyway IMO)

Just going off the report in #3447 I was testing the payee selector in the rules creation modal

On edge: as described in the bug On demo: no hover effect, grayed out background on click that does not persist In this change: hover effect changes text colour to black, but click effect isn't there

Can send videos if you can't reproduce but I've cleared cache etc so it should be the same for everyone

If I remember correctly, the behavior in this PR was how it used to work before. If not, I think the hover effect made in this PR is a better experience than the one in edge/demo.

@jfdoming
Copy link
Contributor

I've double checked as best I can but this doesn't seem to replicate the behaviour in demo (which is a little odd anyway IMO)
Just going off the report in #3447 I was testing the payee selector in the rules creation modal
On edge: as described in the bug On demo: no hover effect, grayed out background on click that does not persist In this change: hover effect changes text colour to black, but click effect isn't there
Can send videos if you can't reproduce but I've cleared cache etc so it should be the same for everyone

If I remember correctly, the behavior in this PR was how it used to work before. If not, I think the hover effect made in this PR is a better experience than the one in edge/demo.

I like that we have a hover effect, but I wonder, could we make it dim the background instead of setting the text colour (similar to other buttons when hovered)? Right now it's only visible on the payee selector in midnight mode, but not the op selector. I also think it would be worth persisting the effect on focus/when the select is open—I think this is how many other apps indicate a select. e.g. see native one in Safari which persists the focus effect:
image

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/settings/Themes.tsx (1)

Line range hint 1-100: Consider enhancing the hover effect based on the feedback.

In the pull request comments, user jfdoming suggested improving the hover effect by dimming the background instead of changing the text color, aligning it with the hover effects of other buttons in the application.

They also recommended that the hover effect should persist on focus or when the select is open, similar to the behavior of native select elements in Safari.

To provide a more consistent and intuitive user experience, consider implementing the following enhancements:

  1. Modify the hover effect to dim the background color instead of changing the text color.
  2. Ensure that the hover effect persists when the select element is focused or open.

This will improve the visual feedback and make the hover behavior more aligned with user expectations and native select element behavior.

packages/desktop-client/src/components/modals/EditRuleModal.jsx (1)

141-141: The style prop is not being utilized effectively.

The style prop is being passed to the OpSelect component, but it is not being applied to any specific element within the component. This prop is not serving any purpose and can be removed to simplify the code.

Remove the style prop from the OpSelect component usage:

-        style={style}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7290c6f and b562e5a.

Files selected for processing (8)
  • packages/desktop-client/src/components/common/Button2.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Select.tsx (4 hunks)
  • packages/desktop-client/src/components/modals/EditRuleModal.jsx (2 hunks)
  • packages/desktop-client/src/components/modals/ImportTransactionsModal.jsx (1 hunks)
  • packages/desktop-client/src/components/reports/Header.tsx (1 hunks)
  • packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx (3 hunks)
  • packages/desktop-client/src/components/settings/Format.tsx (3 hunks)
  • packages/desktop-client/src/components/settings/Themes.tsx (2 hunks)
Files skipped from review due to trivial changes (3)
  • packages/desktop-client/src/components/modals/ImportTransactionsModal.jsx
  • packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx
  • packages/desktop-client/src/components/settings/Format.tsx
Files skipped from review as they are similar to previous changes (2)
  • packages/desktop-client/src/components/common/Button2.tsx
  • packages/desktop-client/src/components/common/Select.tsx
Additional comments not posted (4)
packages/desktop-client/src/components/settings/Themes.tsx (2)

Line range hint 80-85: Verify the impact of the style change on the select's hover behavior.

Similar to the previous comment, the change replaces the :hover pseudo-class with a custom attribute selector &[data-hovered] for styling the select's hover state.

Please ensure that this change does not introduce any regression in the select's hover behavior and that the hover effect is applied consistently across different browsers and devices, especially considering the bug reported in the linked issue (#3447) related to the hover effect on Edge browser.

To verify the impact of this change, you can run the following script:

#!/bin/bash

# Description:
# Verify the usage and behavior of the `data-hovered` attribute in the Select component.

# Test 1: Search for the Select component file.
# Expect: Find the Select.tsx file.
echo "Searching for the Select component file..."
fd --type f --extension tsx Select

# Test 2: Search for custom hover handling logic in the Select component.
# Expect: Find code snippets that manually set the `data-hovered` attribute based on hover state.
echo "Searching for custom hover handling logic in Select component..."
rg --type tsx 'onMouseEnter|onMouseLeave' $(fd --type f --extension tsx Select)

If the above tests yield relevant results, review the code to ensure that the data-hovered attribute is being set correctly based on the hover state and that there are no inconsistencies or potential issues in the hover handling logic specific to the Select component.

Additionally, manually test the select's hover behavior across different browsers, particularly on Edge, to verify that the hover effect is applied consistently and resolves the flickering issue reported in the bug.

Compare the behavior with the demo site and ensure that the hover effect aligns with the expected behavior outlined in the linked issue.


65-69: Verify the impact of the style change on the button's hover behavior.

The change replaces the :hover pseudo-class with a custom attribute selector &[data-hovered] for styling the button's hover state. This modification suggests a shift in how the hover state is managed, potentially using a data-hovered attribute instead of relying on the CSS :hover pseudo-class.

Please ensure that this change does not introduce any regression in the button's hover behavior and that the hover effect is applied consistently across different browsers and devices.

To verify the impact of this change, you can run the following script:

If the above tests yield relevant results, review the code to ensure that the data-hovered attribute is being set correctly based on the hover state and that there are no inconsistencies or potential issues in the hover handling logic.

Additionally, manually test the button's hover behavior across different browsers and devices to verify that the hover effect is applied consistently and as expected.

Verification successful

Verified: The style change is consistent with the project's component styling approach.

The change from :hover to &[data-hovered] in Themes.tsx is part of a broader pattern in the project for certain components, particularly Select components. This approach allows for more controlled hover states and is consistently applied within the file and across other components.

Key observations:

  • The [data-hovered] attribute is used in multiple files, including Themes.tsx.
  • Both Select components in Themes.tsx use the same [data-hovered] styling approach.
  • The :hover pseudo-class is still used elsewhere in the project, indicating this is a targeted change rather than a global replacement.

This change is unlikely to introduce any regression in hover behavior and appears to be a deliberate styling decision for specific components.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description:
# Verify the usage and behavior of the `data-hovered` attribute in the codebase.

# Test 1: Search for the usage of `data-hovered` attribute.
# Expect: Find relevant code snippets that set or modify this attribute.
echo "Searching for 'data-hovered' attribute usage..."
rg --type tsx 'data-hovered'

# Test 2: Search for the component file that defines the hover behavior.
# Expect: Find the relevant component file (e.g., Button.tsx).
echo "Searching for the component file defining hover behavior..."
fd --type f --extension tsx Button

# Test 3: Search for any custom hover handling logic in the component.
# Expect: Find code snippets that manually set the `data-hovered` attribute based on hover state.
echo "Searching for custom hover handling logic..."
rg --type tsx 'onMouseEnter|onMouseLeave'

Length of output: 1373


Script:

#!/bin/bash

# Search for '[data-hovered]' attribute usage
echo "Searching for '[data-hovered]' attribute usage..."
rg "\[data-hovered\]"

# Search for ':hover' pseudo-class usage
echo "Searching for ':hover' pseudo-class usage..."
rg ":hover"

# Search for custom hover handling logic
echo "Searching for custom hover handling logic..."
rg "onMouseEnter|onMouseLeave"

# Check the specific file where the change was made
echo "Checking Themes.tsx file..."
cat packages/desktop-client/src/components/settings/Themes.tsx

Length of output: 12904

packages/desktop-client/src/components/reports/Header.tsx (2)

Line range hint 1-136: LGTM!

The rest of the code changes in this file look good. The modifications are minimal and do not introduce any apparent issues or inconsistencies. The overall structure and logic of the component remain intact.

Also applies to: 138-210


137-137: Verify the impact of the style property change.

The change from buttonStyle to style suggests a shift in the styling approach. Confirm that this change is intentional and aligns with the overall styling strategy in the codebase. Ensure that the new style property is correctly handled by the Select component and does not introduce any unintended visual or behavioral changes.

To verify the impact of this change, run the following script:

Verification successful

Change to style prop is correct and consistent

The change from buttonStyle to style in the Select component is verified to be correct and consistent with the codebase. The Select component properly handles the style prop, applying it to its internal Button component. This change aligns with the overall styling strategy used across different instances of the Select component in the project.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 
# - Verify the usage of the `style` prop in the `Select` component.
# - Check if the `Select` component correctly handles the `style` prop.

# Test 1: Search for the `Select` component usage and analyze the prop usage.
# Expect: Consistent usage of the `style` prop across instances.
rg --type tsx -A 5 $'<Select\b'

# Test 2: Verify the implementation of the `Select` component.
# Expect: The component should correctly handle the `style` prop and apply the styles.
ast-grep --lang tsx --pattern $'export function Select($$$) {
  $$$
  return <$_
    $$$
    style={$_}
    $$$
  />
  $$$
}'

Length of output: 186


Script:

#!/bin/bash
# Description: 
# - Verify the usage of the `style` prop in the `Select` component.
# - Check if the `Select` component is defined in the codebase or imported.

# Test 1: Search for the `Select` component usage in .ts and .tsx files
rg --type-add 'typescript:*.{ts,tsx}' --type typescript -A 5 '<Select\b'

# Test 2: Look for any Select component definition
ast-grep --lang typescript 'function Select($$$) { $$$ }'

# Test 3: Check for Select component imports
rg --type-add 'typescript:*.{ts,tsx}' --type typescript 'import.*Select.*from'

Length of output: 18122


Script:

#!/bin/bash
# Description: 
# - Examine the Select component implementation
# - Verify style prop handling in the Select component

# Test 1: View the Select component implementation
cat packages/desktop-client/src/components/common/Select.tsx

# Test 2: Check for style prop usage in the Select component
rg --type-add 'typescript:*.{ts,tsx}' --type typescript 'style[=:]' packages/desktop-client/src/components/common/Select.tsx

# Test 3: Verify consistent style prop usage across Select components
rg --type-add 'typescript:*.{ts,tsx}' --type typescript '<Select\b.*style=' -A 2

Length of output: 4091


Script:

#!/bin/bash
# Description: 
# - Verify usage of style prop and other styling props for Select component
# - Examine specific files for Select component usage and styling

# Test 1: Check for any prop used for styling the Select component
rg --type-add 'typescript:*.{ts,tsx}' --type typescript '<Select\b.*(?:style|className)=' -A 2

# Test 2: Examine specific files for Select component usage and styling
cat packages/desktop-client/src/components/reports/Header.tsx
cat packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx

# Test 3: Check for any custom styling applied to Select component
rg --type-add 'typescript:*.{ts,tsx}' --type typescript '<Select.*\{.*\}' -A 2

Length of output: 24016

Comment on lines +98 to +101
style={{
color: theme.pageTextPositive,
'&[data-hovered]': { color: theme.pageTextPositive },
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor the inline style to a CSS-in-JS object.

To improve maintainability and readability, consider extracting the inline style object into a separate CSS-in-JS object using the glamor library. This will centralize the style definitions and make the JSX code cleaner.

-        style={{
-          color: theme.pageTextPositive,
-          '&[data-hovered]': { color: theme.pageTextPositive },
-        }}
+        style={styles.fieldSelect}

Then, define the fieldSelect style object using glamor:

const styles = {
  fieldSelect: css({
    color: theme.pageTextPositive,
    '&[data-hovered]': { color: theme.pageTextPositive },
  }),
  // ...other styles
};

Copy link
Contributor

@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.

Looks good! Prefer the hover effect now, thank you.

@joel-jeremy joel-jeremy merged commit e507b8f into master Sep 19, 2024
20 checks passed
@joel-jeremy joel-jeremy deleted the react-aria-button-hover-styles branch September 19, 2024 23:12
This was referenced Sep 19, 2024
@tim-smart
Copy link
Contributor

This caused a regression where some css classes are not prioritized correctly:
image
image

It might surface itself in other places when overriding styles.

a-gradina pushed a commit to a-gradina/actual that referenced this pull request Sep 24, 2024
* Fiox hover styles and use className instead of inline to prepare for future css migration

* Release notes

* Cleanup

* Update edit rule hover style
This was referenced Sep 24, 2024
matt-fidd added a commit that referenced this pull request Oct 3, 2024
* marked files for translation

* added release note

* fixed linting warnings

* 🐛 fix account filters being overridden (#3441)

* :electron: Reduce package size  (#3443)

* reduce package size of all packages

* release notes

* Update beforePackHook.ts

* [Maintenance] Cleanup react aria packages and dedupe (#3450)

* Cleanup react aria packages and dedupe

* Release notes

* ♻️ (synced-prefs) moving the prefs from metadata.json to the db (#3423)

* :electron: Restart server silently when adding self signed cert and add some logs (#3431)

* restart server silently on add self signed cert and add some logging

* release notes

* fix name

* updating names to be more specific

* removing setloading

* feedback

* ♻️ (synced-prefs) move budget type to synced prefs (#3427)

* update synced account balance in db if available (#3452)

* 🐛 (synced-prefs) fix bulk-reading not working in import modal (#3460)

* fix: csv import deduplication (#3456)

* ✨ release simplefin as a first-party feature (#3459)

Closes #2272

* Do not allow renaming to an empty category or group name (#3463)

* Do not allow renaming to an emoty category or group name

* Release notes

* [Mobile] Fix #3214 - Pull down to refresh triggering clicks on budget cells (#3374)

* Fix #3214

* Fix rollover indicator

* VRT

* Fix typecheck error

* VRT

* Release notes

* VRT

* Update style

* Fix budgeted

* VRT

* VRT

* Revert VRT

* VRT

* Fix style

* Revert usePreviewTransactions

* Fix error

* Fix reports form submit handlers (#3462)

* Fix form submit handlers

* Release notes

* :electron: Remove some old updater code (#3468)

* remove some old updater code

* remove old updater logic

* CSV import e2e tests (#3467)

* Fix React Aria Button hover styles  (#3453)

* Fiox hover styles and use className instead of inline to prepare for future css migration

* Release notes

* Cleanup

* Update edit rule hover style

* Undoable auto transfer notes + auto notes for cover (#3411)

* Undo auto transfer notes + auto notes for cover

* Release notes

* Fix notes

* Fix notes undo

* Do not show clicked category on transfer or cover menus

* Fix typecheck error

* typecheck

* Fix removeCategoriesFromGroups

* 🐛 (reports) deleting custom report should remove it from the dashboard (#3469)

* Revert "CSV import e2e tests (#3467)" (#3474)

This reverts commit 5e12d40.

* ♻️ (synced-prefs) separate metadata and local prefs out (#3458)

* :electron: Replace deprecated file protocol registration (#3475)

* replace deprecated file handler in electron

* release notes

* types eh

* types

* update sql regexp to default to empty string when field is null (#3480)

* ♻️ rename report/rollover budget to tracking/envelope (#3483)

* 🐛 (import) fix csv import checkboxes not working (#3478)

* Update tooltip and themes with better visibility (#3298)

* Update tooltip and themes with better visibility

* Rename merge request # into release notes

* rename release note

* update VRT

* tweak light theme

* dont put border on autocomplete menus

* update VRT

* tweak popover style

* simplify

* update VRT

* update VRT

---------

Co-authored-by: Dustin Conlon <dustin@dustinconlon.com>
Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>

* fix modals on mobile BudgetTable (#3487)

* Fix privacy filter (#3472)

* Fix privacy filter

* Release notes

* Coderabbit suggestion

* VRT

* VRT

* Revert VRT

* VRT

* VRT

* VRT

* VRT

* Delete VRT

* VRT

* Revert VRT

* 🐛 fix custom reports crashing when opening table (#3484)

* 🧪 (tests) adding custom report e2e tests (#3493)

* ✨ (dashboards) ability to save filters & timeframes on spending widgets (#3432)

* marked files for translation

* Revert ":bug: fix account filters being overridden (#3441)"

This reverts commit 7336bad.

* Revert "Revert ":bug: fix account filters being overridden (#3441)""

This reverts commit 5cbadc4.

* Revert changes due to failed rebase

* removed import of t

* fixed lint warning

* added PayeeTableRow.tsx

* needed changes

* bugfix: pluralization

* variables adjustments

* removed doubled trans

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
Co-authored-by: Michael Clark <5285928+MikesGlitch@users.noreply.github.com>
Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
Co-authored-by: Koen van Staveren <koenvanstaveren@hotmail.com>
Co-authored-by: Ryan Bianchi <1435081+qedi-r@users.noreply.github.com>
Co-authored-by: Robert Dyer <rdyer@unl.edu>
Co-authored-by: Dustin Conlon <dustin@dustinconlon.com>
Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>
Co-authored-by: Tim <hello@timsmart.co>
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.

[Bug]: Focus/hover in select component not working on edge
5 participants