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: remove hover effect in sign out button #5435

Closed
wants to merge 1 commit into from
Closed

fix: remove hover effect in sign out button #5435

wants to merge 1 commit into from

Conversation

jeeanribeiro
Copy link
Contributor

@jeeanribeiro jeeanribeiro commented May 23, 2024

closes #5406

Resolving the issue only on the Sign out button does not prevent the problem from recurring in other instances. Therefore, I have set a higher specificity in the button's recipe for the disabled and hover state background attribute. This ensures that disabled buttons never have a different background in the hover state, addressing concerns raised in previous PRs.

While I'm generally not a proponent of using !important, it is justified in this context to achieve the desired consistency across the application.

Summary by CodeRabbit

  • Bug Fixes
    • Ensured the background color of disabled buttons takes precedence over other styles.
    • Removed hover background behavior from the Sign Out button in the settings.

Copy link

coderabbitai bot commented May 23, 2024

Walkthrough

The changes ensure that the hover effect for disabled buttons is correctly applied, making the background color consistent and overriding any other styles. Additionally, the hover effect for the SignOutDialog button has been removed, altering its hover behavior.

Changes

File Path Change Summary
theme/recipes/button-recipe.ts Added !important to the _hover state bg property for disabled buttons to ensure precedence.
src/app/features/settings/sign-out/sign-out.tsx Removed the _hover property setting for the SignOutDialog button, affecting hover behavior.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Fix hover effect for disabled button (#5406)

In the code, a change so bright,
A button's hover, now set right.
Disabled states with colors true,
A lighter hue for all to view.
With tweaks so small, yet so grand,
The buttons shine across the land.
🐰✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as 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 full the 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 help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between d023622 and 4e94052.
Files selected for processing (1)
  • theme/recipes/button-recipe.ts (3 hunks)
Additional Context Used
Biome (1)
theme/recipes/button-recipe.ts (1)

3-3: All these imports are only used as types.

Additional comments not posted (2)
theme/recipes/button-recipe.ts (2)

54-54: Ensure the use of !important is absolutely necessary for overriding styles.

While the use of !important can solve specificity issues, it can also make future CSS maintenance harder. Verify if there's an alternative approach that could be used, such as increasing the specificity of the selector in a less forceful manner.


77-77: Consistency in handling hover states for disabled buttons.

The changes consistently apply the !important rule across different button variants to ensure that the hover state is disabled. This aligns with the PR's objective to improve UI consistency by preventing hover effects on disabled buttons.

Also applies to: 99-99

Copy link
Collaborator

@kyranjamie kyranjamie left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @jeeanribeiro—I know there was some discussion before on the sign out button styles.

Investigating further, I think the best fix here is a one line deletion: the sign out button should never have a hover state in the first place.

          <Button
            color="lightModeInk.1"
-            _hover={{ background: 'black' }}
            opacity={!canSignOut ? 0.8 : undefined}
            data-testid={SettingsSelectors.BtnSignOutActuallyDeleteWallet}
            flexGrow={1}
            disabled={!canSignOut}
            onClick={() => canSignOut && onUserDeleteWallet()}
            type="submit"
          >
            Sign out
          </Button>

Discussed this with the team, we'd prefer to avoid !important here. The problem is gone with this line, and there is a possibility in future that we might need to override this style.

@jeeanribeiro jeeanribeiro changed the title fix: sets bg as important in button's disabled hover state fix: remove hover effect in sign out button May 27, 2024
@jeeanribeiro jeeanribeiro requested a review from kyranjamie May 27, 2024 17:56
Copy link

@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 (1)
src/app/features/settings/sign-out/sign-out.tsx (1)

Line range hint 7-8: Consider removing unused named imports if they are only used as types.

- import { Flex, HStack, styled } from 'leather-styles/jsx';
+ import type { Flex, HStack, styled } from 'leather-styles/jsx';
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 4e94052 and f3588e6.
Files selected for processing (1)
  • src/app/features/settings/sign-out/sign-out.tsx (1 hunks)
Additional Context Used
Biome (1)
src/app/features/settings/sign-out/sign-out.tsx (1)

7-8: Some named imports are only used as types.

Additional comments not posted (3)
src/app/features/settings/sign-out/sign-out.tsx (3)

Line range hint 11-18: The form setup and submission logic are correctly implemented.


Line range hint 11-18: The use of the Callout component to provide wallet-specific warnings is well-implemented.


Line range hint 11-18: Ensure that the CSS changes for button hover effects align with the button properties set here.

Verification successful

The previous script failed due to an unrecognized file type. Let's correct the file type and re-run the script to search for the CSS changes related to hover effects.


The previous script did not produce any output, indicating that the specific CSS change might not be present in the file we searched. To ensure thorough verification, we should search for any CSS changes related to hover effects in the entire repository.


The previous attempts to locate CSS changes related to hover effects did not yield any results. This suggests that either the hover effects are not defined in CSS files or they are defined in a different manner. To ensure thorough verification, we should search for hover effects in all relevant files, including TypeScript and JavaScript files, as they might contain inline styles or styled-components.


The search results indicate that there are multiple instances of hover effects defined across various files in the repository, including theme/recipes/button-recipe.ts and other component files. This confirms that hover effects are indeed being managed within the codebase.

Given this context, it appears that the hover effects are being handled appropriately and consistently across the repository. The changes in the SignOutDialog component should align with these hover effect definitions.

  • theme/recipes/button-recipe.ts contains several hover effect definitions, such as _hover: { bg: 'ink.background-secondary' } and _hover: { bg: 'unset' }.
  • Other files like src/app/ui/pressable/pressable.tsx and src/app/ui/pages/welcome.layout.tsx also define hover effects.

Based on this information, the hover effects are being managed consistently, and the changes in the SignOutDialog component should not introduce any inconsistencies.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the CSS changes for hover effects are consistent with the button properties in this file.

# Test: Search for the CSS changes in the mentioned file and ensure consistency.
rg --type typescript --files-with-matches 'ink.background-secondary !important' theme/recipes/button-recipe.ts

Length of output: 147



Script:

#!/bin/bash
# Description: Verify that the CSS changes for hover effects are consistent with the button properties in this file.

# Test: Search for the CSS changes in the mentioned file and ensure consistency.
rg --type ts --files-with-matches 'ink.background-secondary !important' theme/recipes/button-recipe.ts

Length of output: 104



Script:

#!/bin/bash
# Description: Verify that the CSS changes for hover effects are consistent with the button properties in this file.

# Test: Search for any CSS changes related to hover effects in the entire repository.
rg --type css 'hover'

Length of output: 21



Script:

#!/bin/bash
# Description: Verify that the CSS changes for hover effects are consistent with the button properties in this file.

# Test: Search for any hover effects in the entire repository, including TypeScript and JavaScript files.
rg 'hover' --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}'

Length of output: 12878

@jeeanribeiro
Copy link
Contributor Author

jeeanribeiro commented May 27, 2024

Thanks for the PR @jeeanribeiro—I know there was some discussion before on the sign out button styles.

Investigating further, I think the best fix here is a one line deletion: the sign out button should never have a hover state in the first place.

          <Button
            color="lightModeInk.1"
-            _hover={{ background: 'black' }}
            opacity={!canSignOut ? 0.8 : undefined}
            data-testid={SettingsSelectors.BtnSignOutActuallyDeleteWallet}
            flexGrow={1}
            disabled={!canSignOut}
            onClick={() => canSignOut && onUserDeleteWallet()}
            type="submit"
          >
            Sign out
          </Button>

Discussed this with the team, we'd prefer to avoid !important here. The problem is gone with this line, and there is a possibility in future that we might need to override this style.

Hello @kyranjamie 👋

Thank you for the review! I’ve updated the PR to remove the line you mentioned. I also generally avoid using !important, but it was necessary in the previous context to achieve our goal.

I appreciate how welcoming the team is with my PRs. While I'm currently addressing small UI issues, I'm eager to participate in broader UI discussions.

Thanks again to the team for being so welcoming! 😄

@pete-watters
Copy link
Contributor

Thanks again @jeeanribeiro for your contributions. I've merged this work here #5460

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

Successfully merging this pull request may close these issues.

Fix hover effect for disabled button
3 participants