[go: nahoru, domu]

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: add aria-labels to tools button and metric toggle #9201

Merged
merged 1 commit into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
}

// Metrics.
const metricAudits = category.auditRefs.filter(audit => audit.group === 'metrics');
const metricAuditsEl = this.renderAuditGroup(groups.metrics);

// Metric descriptions toggle.
const toggleTmpl = this.dom.cloneTemplate('#tmpl-lh-metrics-toggle', this.templateContext);
const toggleEl = this.dom.find('.lh-metrics-toggle', toggleTmpl);
metricAuditsEl.prepend(...toggleEl.childNodes);
metricAuditsEl.append(...toggleEl.childNodes);
Copy link
Member Author

Choose a reason for hiding this comment

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

prepend() made the screen reader version of the category really confusing.

Maybe prepending was done because the code reads at first glance like the toggle needs to be prepended to come before the rendered audits, but renderAuditGroup() only renders the container and the group header, not the audits themselves, so the toggle should be the last child of metricAuditsEl at this point.

...or maybe the code just changed over time and this was a holdover of a different version :) Moved the metricAudits filter statement to try to make the order of things clearer, regardless.


const metricAudits = category.auditRefs.filter(audit => audit.group === 'metrics');
const keyMetrics = metricAudits.filter(a => a.weight >= 3);
const otherMetrics = metricAudits.filter(a => a.weight < 3);

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/report/html/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<!-- Lighthouse metrics toggle -->
<template id="tmpl-lh-metrics-toggle">
<div class="lh-metrics-toggle">
<input class="lh-metrics-toggle__input" type="checkbox" name="toggle-metric-descriptions">
<input class="lh-metrics-toggle__input" type="checkbox" id="toggle-metric-descriptions" aria-label="Toggle the display of metric descriptions">
<label class="lh-metrics-toggle__label" for="toggle-metric-descriptions">
<div class="lh-metrics-toggle__icon lh-metrics-toggle__icon--less" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">
Expand Down Expand Up @@ -366,7 +366,7 @@
<a href="" class="lh-topbar__url" target="_blank" rel="noopener"></a>

<div class="lh-tools">
<button class="report-icon report-icon--share lh-tools__button" title="Export report">
<button class="report-icon report-icon--share lh-tools__button" title="Tools menu" aria-label="Toggle report tools menu">
Copy link
Collaborator

Choose a reason for hiding this comment

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

at what point does i18n creep into here? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

at what point does i18n creep into here? :)

😬

(probably should have a while ago)

Copy link
Collaborator

Choose a reason for hiding this comment

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

this be the point: #9166

<svg width="100%" height="100%" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
Expand Down