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: highlight Data Input link #9676

Merged
merged 3 commits into from
Jul 22, 2024
Merged

fix: highlight Data Input link #9676

merged 3 commits into from
Jul 22, 2024

Conversation

keita-determined
Copy link
Contributor

@keita-determined keita-determined commented Jul 17, 2024

Ticket

ET-638

Description

Blue color link instead of white link for Data Input card to let users know its clickable

image

Test Plan

  • Data Input card should have blue link in the experiment detail page
  • Data Input instead of Data input

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@cla-bot cla-bot bot added the cla-signed label Jul 17, 2024
@keita-determined keita-determined marked this pull request as ready for review July 17, 2024 20:59
@keita-determined keita-determined requested a review from a team as a code owner July 17, 2024 20:59
Copy link

netlify bot commented Jul 17, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 5d5c258
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/6699740f9f0c9b00082d12f5
😎 Deploy Preview https://deploy-preview-9676--determined-ui.netlify.app
📱 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

@johnkim-det johnkim-det left a comment

Choose a reason for hiding this comment

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

can we just use a Link or something in OverviewStats when it has an onClick value? and remove style attribute usage from here and "Resource Allocation"?

@keita-determined
Copy link
Contributor Author

keita-determined commented Jul 17, 2024

can we just use a Link or something in OverviewStats when it has an onClick value? and remove style attribute usage from here and "Resource Allocation"?

fixed

image

Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 48.70%. Comparing base (274d763) to head (5d5c258).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9676      +/-   ##
==========================================
- Coverage   53.32%   48.70%   -4.63%     
==========================================
  Files        1254      931     -323     
  Lines      152655   123420   -29235     
  Branches     3244     3242       -2     
==========================================
- Hits        81398    60106   -21292     
+ Misses      71105    63162    -7943     
  Partials      152      152              
Flag Coverage Δ
harness ?
web 51.55% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
webui/react/src/components/OverviewStats.tsx 100.00% <100.00%> (ø)
...ebui/react/src/pages/TrialDetails/TrialInfoBox.tsx 89.16% <50.00%> (+1.81%) ⬆️

... and 323 files with indirect coverage changes

Comment on lines 27 to 29
<span style={{ color: props.onClick ? 'var(--theme-status-active)' : 'inherit' }}>
{props.children}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

does Link not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const OverviewStats: React.FC<Props> = (props: Props) => {
const column = (
<Column>
<Row>
<Label size={TypographySize.XS} truncate={{ tooltip: true }}>
{props.title}
</Label>
</Row>
<Row width="fill">
<Label strong truncate={{ tooltip: true }}>
{props.children}
</Label>
</Row>
</Column>
);
return <Card>{props.onClick ? <Link onClick={props.onClick}>{column}</Link> : column}</Card>;

it works in terms of the appearance, but that might cause nested anchor tag (<a>) which is forbidden.

https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element

there must be no interactive content descendant

Copy link
Contributor

Choose a reason for hiding this comment

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

honestly it's kind of weird we have a link for a specific line within a clickable card in the first place, but I'd prefer to use Link, partially because it also has the hover styling.

I think the nested <a> is only happening because the card content is also unnecessarily wrapped in a Link when instead it should be using the Card's onClick (which also adds hover styling to the card itself)

suggestion:

   return (
    <Card onClick={props.onClick}>
      <Column>
        <Row>
          <Label size={TypographySize.XS} truncate={{ tooltip: true }}>
            {props.title}
          </Label>
        </Row>
        <Row width="fill">
          <Label strong truncate={{ tooltip: true }}>
            {props.onClick ? (
              <Link>
                {props.children}
              </Link>
            ) : props.children}
          </Label>
        </Row>
      </Column>
    </Card>
  );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it. also unwraped <Link> in card content

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 we should probably still have onClick on Card?

Copy link
Contributor Author

@keita-determined keita-determined Jul 18, 2024

Choose a reason for hiding this comment

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

imo only blue text should be clickable. otherwise nested anchor issue would happen

Copy link
Contributor

Choose a reason for hiding this comment

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

if product agrees, sure. my suggestion was to avoid removing functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

product agreed with only text link (Slack)

@keita-determined keita-determined merged commit ca90a63 into main Jul 22, 2024
81 of 94 checks passed
@keita-determined keita-determined deleted the fix/link-color branch July 22, 2024 19:22
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.

2 participants