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

Make Label Cursor Hoverable #3332

Merged

Conversation

YuliaKrimerman
Copy link
Contributor

https://issues.redhat.com/browse/RHOAIENG-13047

Description

Made the labels indicate they are hoverable in Settings page

Screen.Recording.2024-10-14.at.3.47.21.PM.mov

How Has This Been Tested?

On the UI

Test Impact

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

I think the label should only be hoverable for "Unavailable" and any other labels where we are showing a popover. There are no actions for "Available" and "Progressing" AFAIR - so no use making it hoverable(and confusing the users). Also, I think it's a bad practice to use void 0(makes it inaccessible for screen readers- reference link) Can we use a button instead? - I think button is hoverable by default.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.08%. Comparing base (ae66e3b) to head (2894d1b).
Report is 18 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3332      +/-   ##
==========================================
+ Coverage   84.80%   85.08%   +0.28%     
==========================================
  Files        1315     1326      +11     
  Lines       29491    29707     +216     
  Branches     8056     8132      +76     
==========================================
+ Hits        25009    25277     +268     
+ Misses       4482     4430      -52     
Files with missing lines Coverage Δ
...elRegistrySettings/ModelRegistryTableRowStatus.tsx 98.85% <100.00%> (+0.08%) ⬆️

... and 87 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae66e3b...2894d1b. Read the comment docs.

@YuliaKrimerman
Copy link
Contributor Author

@manaswinidas Made it hoverable only for the 2 needed statuses. Kept it as Label because of the color prop vs button. addressed the void 0 issue as well

<Label
{...(isClickable
? {
onClick: () => {
Copy link
Contributor

@manaswinidas manaswinidas Oct 17, 2024

Choose a reason for hiding this comment

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

not sure if we should prefer this over style={{ cursor: 'pointer' }} 🤔
(inspiration from #3344 - let me know if this works though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already looks like the hand pointer, just like in the video. Or is it a different way we want it to look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to add that style but it's not changing anything from what I see - it remains the pointing hand ( like in the picture but just white and slightly bent)
Screenshot 2024-10-17 at 12 29 18 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe the suggestion was to avoid the noop function, but I think it's probably fine either way - inline styles are also not great 🤷

@YuliaKrimerman can you just add more detail to the comment in that noop function, something like "Click event is handled by the Popover parent, this prop enables clickable styles in the PatternFly Label"?

<Label
{...(isClickable
? {
onClick: () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe the suggestion was to avoid the noop function, but I think it's probably fine either way - inline styles are also not great 🤷

@YuliaKrimerman can you just add more detail to the comment in that noop function, something like "Click event is handled by the Popover parent, this prop enables clickable styles in the PatternFly Label"?

@@ -118,8 +117,24 @@ export const ModelRegistryTableRowStatus: React.FC<ModelRegistryTableRowStatusPr
}
}

const isClickable =
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can have this logic based on whether there's a popover instead of based on status.

const isClickable = popoverTitle && popoverMessages.length;

@mturley
Copy link
Contributor

mturley commented Oct 18, 2024

@manaswinidas regarding the void 0 issue, the way I interpret that document is to say a link shouldn't have void 0 since links should navigate to a URL, and if it's an action a button is better - in this case we have a button and the click event does "do something" (it bubbles up to the popover parent), the empty onClick function is simply because that's what triggers the PF clickable styles. So I think we're ok on a11y. But changing it from void 0 to be an empty function with a comment looks more readable to me.

Also I think using just the cursor:pointer style wouldn't be good enough because the onClick also triggers a darker border on clickable labels.

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

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

LGTM - @manaswinidas if you disagree with the approval let's follow up

@openshift-ci openshift-ci bot added the lgtm label Oct 18, 2024
Copy link
Contributor

openshift-ci bot commented Oct 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mturley mturley dismissed manaswinidas’s stale review October 18, 2024 15:10

Comments addressed - may require followup conversation but shouldn't block the PR

@openshift-merge-bot openshift-merge-bot bot merged commit 2305d0a into opendatahub-io:main Oct 18, 2024
8 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.

3 participants