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

report(redesign): tooltip for category description #8840

Closed
wants to merge 22 commits into from

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark requested a review from paulirish as a code owner May 3, 2019 19:37
<div class="lh-category-header__description"></div>
<div class="lh-score__gauge">
<!-- Will be added to .lh-gauge__label via renderCategoryHeader -->
<!-- <span class="tooltip-boundary">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should i make this a template

Copy link
Member

Choose a reason for hiding this comment

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

yup, i think so. include in this one and .remove() if there's no description?

<div class="lh-category-header__description"></div>
<div class="lh-score__gauge">
<!-- Will be added to .lh-gauge__label via renderCategoryHeader -->
<!-- <span class="tooltip-boundary">
Copy link
Member

Choose a reason for hiding this comment

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

yup, i think so. include in this one and .remove() if there's no description?

--lh-group-icon-background-size: var(--lh-score-icon-background-size);
--lh-info-icon-background-size: 20px;
--lh-score-icon-background-size: 24px;
Copy link
Member

Choose a reason for hiding this comment

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

just -lh-score-icon-size ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

btw ur commenting on something i just reordered

i added --lh-info-icon-background-size

could rename stuff after all this tho

@vercel vercel bot temporarily deployed to staging May 3, 2019 20:04 Inactive
@@ -1289,7 +1291,7 @@
position: absolute;
display: none; /* Don't retain these layers when not needed */
opacity: 0;
background: #ffffff;
background: var(--body-background-color);
Copy link
Member

Choose a reason for hiding this comment

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

good catch

@paulirish
Copy link
Member

lighthouse-core/test/report/html/renderer/category-renderer-test.js is cranky.

paulirish
paulirish previously approved these changes May 6, 2019
Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

lgtm once tests are happy.

@connorjclark
Copy link
Collaborator Author

done. had to introduce a wrapper el so that the label el makes more sense :)

@@ -185,7 +185,7 @@ describe('CategoryRenderer', () => {
const categoryDOM = renderer.render(category, sampleResults.categoryGroups);
assert.ok(categoryDOM.querySelector('.lh-gauge__wrapper--plugin'));
const label = categoryDOM.querySelector('.lh-gauge__label').textContent;
assert.equal(category.title, label);
assert.equal(label, category.title);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

was backwards

Copy link
Member

Choose a reason for hiding this comment

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

was backwards

just for code correctness purposes, not a functional change in the test, I hope?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes

@paulirish
Copy link
Member

can you resolve the conflict?

@connorjclark
Copy link
Collaborator Author

connorjclark commented May 6, 2019 via email

@connorjclark
Copy link
Collaborator Author

merged master

next steps on this?

@connorjclark
Copy link
Collaborator Author

connorjclark commented May 25, 2019

image

uh....bump it up? if we truly want to keep it under 70, we can open an issue to research how to do that

@brendankenny
Copy link
Member

  • bump it up? if we truly want to keep it under 70, we can open an issue to research how to do that

    I think that's fine. We've been hovering above 69KB for a while now, and adding things to the report renderer was going to do it sooner or later. 75KB?

  • The tooltips don't appear to be working right now, at least in the deployed example.

  • so, there are two states here: gauge+label for the scores header, gauge+label+optional-description for categories? I'm not entirely following what's needed with <a> vs not <a>, though.

    Rather than passing the option into renderScoreGauge, can it go back to how it was before, adding a tooltip if there's a description in renderCategoryHeader() (ensuring the score header gauges don't get one).

    If there's more needed to sort out the anchor business, maybe it needs to be split more. The different category vs scores-header gauges aren't really the same thing except the score gauge...we could have renderScoreGauge return only what's really shared between the two uses and move more functionality back to the call sites.

@connorjclark
Copy link
Collaborator Author

incorporated @brendankenny's feedback

@patrickhulce
Copy link
Collaborator

Sorry @hoten seems like this regressed again at some point in the feedback cycle.

image

@connorjclark
Copy link
Collaborator Author

oops, fixed that

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1246,7 +1281,6 @@
}

.lh-category-header .lh-score__gauge {
max-width: 400px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

just unnecessary or do we want the gauges to get bigger than this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unnecessary

@@ -1470,7 +1504,6 @@
display: block;
animation: fadeInTooltip 250ms;
animation-fill-mode: forwards;
animation-delay: 850ms;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this removes this everywhere, we want that right? I would guess so because a lot of folks don't seem to know that they can hover over the error to get the tooltip 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, I figured it doesn't make sense to inject 850ms of latency for this.

}
.lh-gauge__label-info-icon {
pointer-events: fill;
cursor: help;
Copy link
Collaborator

Choose a reason for hiding this comment

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

feels a tad odd to me to flip the cursor since there's no actual click action here, is there a broader UX strategy here? I would love to learn more about these kinds of things :)

Copy link
Collaborator Author

@connorjclark connorjclark May 30, 2019

Choose a reason for hiding this comment

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

honestly, I had the bring the cursor back with CSS so I just picked one. Since there's no click action to prompt perhaps it should just remain a normal cursor. IDK.

@yuinchien what do you think of this?
https://lighthouse-33lan68g9.now.sh/#accessibility (hover over i)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@hoten I suggest shifting the position 4px downward and to the right.

I applied transform: translate3d(4px,4px,0) to the info icon and it looks like this.

Screen Shot 2019-05-30 at 10 22 10 AM

@@ -242,7 +242,7 @@ describe('PwaCategoryRenderer', () => {
describe('#renderScoreGauge', () => {
it('renders an error score gauge in case of category error', () => {
category.score = null;
const badgeGauge = pwaRenderer.renderScoreGauge(category);
const badgeGauge = pwaRenderer.renderScoreGauge(category, null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the point of this one? typedef suggests both are unexpected but looking through the code it looks like we never used groups for the score gauge no matter what.... 🤷‍♂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't recall, removed.

@brendankenny
Copy link
Member

https://www.matuzo.at/blog/building-the-most-inaccessible-site-possible-with-a-perfect-lighthouse-score/

is an argument against moving the accessibility description to a tooltip (see especially the conclusion at the end). Maybe it would be better just to shorten + only exist if there's something really important to say

@connorjclark
Copy link
Collaborator Author

what are we doing with this?

@brendankenny
Copy link
Member

what are we doing with this?

I don't think we want to do this. Implementation complexity, not a huge win in terms of simplification, and an arguable net loss of explainable utility

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.

6 participants