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

feat: add groups to config, accessibility renderer #2057

Merged
merged 13 commits into from
May 3, 2017

Conversation

patrickhulce
Copy link
Collaborator

addresses topics item in #1937

I'd prefer to leave UI bikeshedding for when we implement the real version that's going in DevTools, but here's a screenshot
image

Copy link
Contributor

@ebidel ebidel left a comment

Choose a reason for hiding this comment

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

This is neat.

@@ -568,6 +569,11 @@ class Config {
get categories() {
return this._categories;
}

/** @type {Object<{title: string, description: string}>} */
Copy link
Contributor

Choose a reason for hiding this comment

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

closure noob here. can this be:{{title: string, description: string}}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's an object where the values are {title: string, description: string} but IIRC we actually need Object<string,{title: string, description: string}> now, will update

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! That makes more sense :)

{"id": "bypass", "weight": 1, "tags": ["accessibility-describe-contents"]},
{"id": "color-contrast", "weight": 1, "tags": ["accessibility-color-contrast"]},
{"id": "definition-list", "weight": 1, "tags": ["accessibility-well-structured"]},
{"id": "dlitem", "weight": 1, "tags": ["accessibility-well-structured"]},
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we could shorten these to a11y-*. Doesn't all this stuff end up in our json dump?

Copy link
Collaborator Author

@patrickhulce patrickhulce Apr 26, 2017

Choose a reason for hiding this comment

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

done, yep it does

@@ -142,7 +142,16 @@ class CategoryRenderer {
* @param {!ReportRenderer.CategoryJSON} category
* @return {!Element}
*/
render(category) {
render(category, tags) {
Copy link
Contributor

Choose a reason for hiding this comment

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

tags needs a doc string

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}
}

_renderDefaultCategory(category) {
Copy link
Contributor

Choose a reason for hiding this comment

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

docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -167,6 +176,69 @@ class CategoryRenderer {
element.appendChild(passedElem);
return element;
}

_renderAuditGroup(audits, tag) {
Copy link
Contributor

Choose a reason for hiding this comment

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

docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

const auditGroupHeader = this._dom.createElement('div', 'lh-audit-group__header');
auditGroupHeader.textContent = tag.title;

const auditGroupDescription = this._dom.createElement('div', 'lh-audit-group__description');
Copy link
Contributor

Choose a reason for hiding this comment

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

you can style the details arrow like the rest by adding a selector like

.lh-score__snippet::-moz-list-bullet {
display: none;
}
.lh-score__snippet::-webkit-details-marker {
display: none;
}
and generating markup like
<summary class="lh-score__snippet">
<span class="lh-score__title"><!-- fill me --></span>
<div class="lh-score__arrow" title="See audits"></div>
</summary>
. lh-score__arrow is the gem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I saw that but wasn't convinced we wanted to reuse those, lh-score gives me the idea that it's a scored thing specific to audit or category when these are just display groupings. If we want to reuse the same CSS, maybe we can extract it to a different distinct reusable component without tying the category/audit dependency?

Copy link
Contributor

@ebidel ebidel Apr 26, 2017

Choose a reason for hiding this comment

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

Yea, we can rename the CSS if you need to.

"distinct reusable component"....interesting idea. Tell me more :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"distinct reusable component"....interesting idea. Tell me more

hahaha, I've never had anything against organization of code into components :)

return auditGroupElem;
}

_renderAccessibilityCategory(category, tags) {
Copy link
Contributor

Choose a reason for hiding this comment

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

docs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

}

.lh-audit-group__summary::-webkit-details-marker {
float: right;
Copy link
Contributor

Choose a reason for hiding this comment

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

i dont think you need these styles if using lh-score__arrow

@ebidel ebidel mentioned this pull request Apr 27, 2017
@patrickhulce
Copy link
Collaborator Author

rebased against the mega-branch lookin' fly now 😎
image

@ebidel
Copy link
Contributor

ebidel commented Apr 28, 2017

Should we have the dropdown arrows on the categories? Otherwise, it's not obvious you can expand them.

screen shot 2017-04-28 at 3 18 33 pm

@patrickhulce
Copy link
Collaborator Author

Should we have the dropdown arrows on the categories? Otherwise, it's not obvious you can expand them.

Yeah we should, fixed

@ebidel
Copy link
Contributor

ebidel commented Apr 28, 2017

Also now noticing the arrow don't turn. They're always in the down state:

screen shot 2017-04-28 at 3 30 25 pm

You need some of

transform: rotateZ(90deg);
action.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

how do you feel about tests for this

@@ -568,6 +569,11 @@ class Config {
get categories() {
return this._categories;
}

/** @type {Object<string, {title: string, description: string}>} */
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe this would be nullable. Is it |undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if we're bein' real it's * for most of these defs since the config can stick whatever it wants here ;) but yeah could be undefined I'll add

{"id": "valid-lang", "weight": 1},
{"id": "video-caption", "weight": 1},
{"id": "video-description", "weight": 1},
{"id": "accesskeys", "weight": 1, "tags": ["a11y-correct-attributes"]},
Copy link
Member

Choose a reason for hiding this comment

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

  • since this is scoped, should we just call this group or something?
  • since we're only supporting the first entry, should we just drop the array?
  • since we're requiring a tag for accessibility audits, should there be a check with a clear warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm against doing a one off config thing per category when we can re-use the same concept, but are you proposing just renaming tags -> groups ?

since we're requiring a tag for accessibility audits, should there be a check with a clear warning?

sure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

since we're only supporting the first entry, should we just drop the array?

accessibility only uses one, but forcing one already seems bad when we just planned last week to achieve the PWA goals with multiple tags on a one

Copy link
Member

Choose a reason for hiding this comment

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

brendan is thinking group making it 1:1 instead of 1:many. So each a11y audit only belongs to a single group. Same with perf.

Doing this means we wouldn't have the ability for an audit to live in two "groups", but that seems decent for now. I can't think of where we actually NEED the extensibility of 1audit:many tags.
So perhaps it's better to keep it simple for now.

@patrickhulce is there a 1:many usecase you're keeping in mind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had thought we decided to use tags in the certifications-style rendition of PWA checklist, but if that's a totally distinct "tag" so to speak then I'm down with 1:1 group

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

talked to paul, I was hearing/thinking random things. certifications are to be totally separate from tags (phew!) and group sgtm 👍

@ebidel
Copy link
Contributor

ebidel commented Apr 28, 2017

Ah interesting. Looks like we need to be more specific with our selectors for the arrows....now that there are sub sub arrows :)

Changing to this works:
.lh-expandable-details[open] > .lh-expandable-details__summary > .lh-toggle-arrow

@patrickhulce
Copy link
Collaborator Author

patrickhulce commented Apr 28, 2017

Changing to this works:
.lh-expandable-details[open] > .lh-expandable-details__summary > .lh-toggle-arrow

yup that's what I got now :)

@patrickhulce
Copy link
Collaborator Author

how do you feel about tests for this

like we should definitely have some 👍

@patrickhulce
Copy link
Collaborator Author

PTAL this is blocking #2111 :)

@brendankenny
Copy link
Member

accessibility only uses one, but forcing one already seems bad when we just planned last week to achieve the PWA goals with multiple tags on a one

understood, I'm just thinking if we only have like three uses of this hardcoded into each categoryRenderer, having a generic tags section seems like overkill (general solution for a small number of situations) and less descriptive than it could be (if we just called them what they each were). If we start approaching more uses of these than that, then a generic solution does start looking better.

@patrickhulce patrickhulce changed the title feat: add topics to config, accessibility renderer feat: add groups to config, accessibility renderer May 1, 2017
@paulirish
Copy link
Member

lgtm on groups refactor

@patrickhulce
Copy link
Collaborator Author

@brendankenny you appeased? :)

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

sweet, LGTM

@brendankenny brendankenny merged commit cee0dea into master May 3, 2017
@brendankenny brendankenny deleted the accessibility_tags branch May 3, 2017 01:40
@paulirish
Copy link
Member

ELL GEE TEE EMM

paulirish added a commit that referenced this pull request May 3, 2017
paulirish pushed a commit to paulirish/lighthouse that referenced this pull request May 5, 2017
paulirish added a commit to paulirish/lighthouse that referenced this pull request May 5, 2017
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.

4 participants