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

MudTooltip: Add Disabled parameter #8876

Merged
merged 5 commits into from
May 7, 2024

Conversation

Yomodo
Copy link
Contributor

@Yomodo Yomodo commented May 4, 2024

Description

Resolves #8842

How Has This Been Tested?

Added 3 unit tests
Added 1 visual test

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added docs Related to docs enhancement New feature or request PR: needs review labels May 4, 2024
Copy link

codecov bot commented May 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.21%. Comparing base (28bc599) to head (df46ea4).
Report is 154 commits behind head on dev.

❗ Current head df46ea4 differs from pull request most recent head a31dc31. Consider uploading reports for the commit a31dc31 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8876      +/-   ##
==========================================
+ Coverage   89.82%   90.21%   +0.38%     
==========================================
  Files         412      424      +12     
  Lines       11878    12286     +408     
  Branches     2364     2406      +42     
==========================================
+ Hits        10670    11084     +414     
+ Misses        681      669      -12     
- Partials      527      533       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Good idea, I wonder why it was never added before.

I think the test should check onmouseenter too and explicitly enable ShowOnHover and ShowOnFocus for the corresponding tests to ensure it's capturing the right context. The Visible property should never be set to true while disabled and that should be tested as well.

@Yomodo
Copy link
Contributor Author

Yomodo commented May 6, 2024

The Visible property should never be set to true while disabled and that should be tested as well.

@danielchalmers Do you mean I need to modify/add the logic in the Visibility setter that prevents setting when disabled
or only ensure (test) that Visibility never gets changed when toggling the tooltip disabled state?

@danielchalmers
Copy link
Contributor

Do you mean I need to modify/add the logic in the Visibility setter that prevents setting when disabled or only ensure (test) that Visibility never gets changed when toggling the tooltip disabled state?

I was thinking that the Visible property shouldn't be set to true (inside HandleMouseEnter, HandleFocusIn, HandleMouseUp) if Disabled == true to avoid a misleading state since it's not actually visually rendered.

I'm not sure what should happen if the user uses the Visible setter to make it explicitly true while Disabled == true 🤔

@Yomodo
Copy link
Contributor Author

Yomodo commented May 6, 2024

I was thinking that the Visible property shouldn't be set to true (inside HandleMouseEnter, HandleFocusIn, HandleMouseUp) if Disabled == true to avoid a misleading state since it's not actually visually rendered.

All 5 HandleXXX methods set the Visible state.
However, the entire MudPopover is skipped from rendering when Disabled == true, so I don't see an issue here.
(Of course I might miss something)

I'm not sure what should happen if the user uses the Visible setter to make it explicitly true while Disabled == true 🤔

I believe that nothing should happen when Disabled == true and other properties are set.
I'm assuming this behavior also applies to all other MudBlazor components.

@danielchalmers
Copy link
Contributor

My point is from a public API perspective where someone might rely on the Visible property to know whether or not the tooltip is actually open on the screen

@ScarletKuro ScarletKuro requested a review from henon May 6, 2024 20:09
@danielchalmers
Copy link
Contributor

Do you think you could take a look at #4466 as well? Seems like a simple fix.

@Yomodo
Copy link
Contributor Author

Yomodo commented May 7, 2024

My point is from a public API perspective where someone might rely on the Visible property to know whether or not the tooltip is actually open on the screen

By default Disabled == false, so no harm done.
Once people are aware of this new parameter they'll adjust their logic?

@henon
Copy link
Collaborator

henon commented May 7, 2024

In all other components Disabled prevents user interaction via mouse / keyboard. So this implementation is ok, we don't have to concern ourselves with the fact that the library consumer can force it open via the Visible parameter, that may be exactly what they want and lies entirely in their own responsibility.

@henon henon removed docs Related to docs PR: needs review labels May 7, 2024
@henon henon merged commit a825eaf into MudBlazor:dev May 7, 2024
2 checks passed
@henon
Copy link
Collaborator

henon commented May 7, 2024

Thanks Yomodo! FYI @ScarletKuro

@Yomodo Yomodo deleted the Mudtooltip_Disabled_property branch May 7, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MudTooltip: Add Disabled parameter
3 participants