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: quick tab #9175

Closed
wants to merge 8 commits into from
Closed

report: quick tab #9175

wants to merge 8 commits into from

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Jun 10, 2019

Inspired by GitHub's quick tab feature:

image

image

I'll deal with the errors + add tests after feedback.

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.

well that was quick :) nice!

const {selector, label} = firstContentSelectors.find(({selector}) => {
const el = this._document.querySelector(selector);
return Boolean(el && el instanceof HTMLElement);
}) || {selector: '.lh-category-header .lh-gauge__wrapper', label: 'Jump to first category.'};
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just put this last in the array?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because this asserts that the variable will always be non-null (if find returns null, the || is the backup)

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like sort of a roundabout way of asserting that :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair - I refactored it.


const startOfContentEl = this._dom.find(selector, this._document);
const quickFocusEl = this._dom.find('.lh-a11y-quick-focus', this._document);
quickFocusEl.innerText = label;
Copy link
Collaborator

Choose a reason for hiding this comment

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

.textContent?

background-color: var(--color-blue);
color: var(--color-white);
padding: 20px;
clip: rect(1px, 1px, 1px, 1px);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why clip?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. Here's a bad answer: I took it straight from GitHub.

display: none -> block won't work, because you can't focus onto a display: none element. opacity: 0 -> 1 does work, though. I wonder if there might be screen readers that will ignore 0 opacity elements.

</style>

<!-- This is disabled by default. Enabled in ReportUIFeatures. -->
<a href="#" class="lh-a11y-quick-focus disabled" tabindex="1">asd</a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

asd significant in any way?

@@ -84,6 +84,7 @@ class ReportUIFeatures {
this._setupToolsButton();
this._setupThirdPartyFilter();
this._setUpCollapseDetailsAfterPrinting();
this._setUpQuickTabFocus();
Copy link
Collaborator

Choose a reason for hiding this comment

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

lol this setUp typo has survived a full 2 years https://github.com/GoogleChrome/lighthouse/pull/2000/files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ahhhhh now I can't unsee.

@connorjclark
Copy link
Collaborator Author

oops didn't mean to close.

Also, I need to do i18n :)

@paulirish
Copy link
Member

paulirish commented Jun 11, 2019

i read up a bit on "skip links" because it's been so long.

https://webaim.org/techniques/skipnav/
https://www.w3.org/TR/WCAG20-TECHS/G1.html
https://dequeuniversity.com/rules/axe/3.2/skip-link

the intent is for skipping over the navigation.

in our case we just have the URL in the topbar, followed by the export/tools menu, then we get into the gauges. I'd consider the gauges the first "content" since they change on each run. Jumping past them doesn't seem to align with the idea of a "skip link" IMO.

Given that, I don't think this feature brings much user value. :/ sorry.

Relatedly, when I flip on voiceover on my mac, I do see that our tools menu items are focusable when invisible. The general keyboard interaction with the tools menu seems a little atypical. If we want to improve the a11y of browsing our report, I think that'd be a good fix.

@brendankenny
Copy link
Member

Relatedly, when I flip on voiceover on my mac, I do see that our tools menu items are focusable when invisible. The general keyboard interaction with the tools menu seems a little atypical. If we want to improve the a11y of browsing our report, I think that'd be a good fix.

add it to #9183!

@connorjclark
Copy link
Collaborator Author

connorjclark commented Jun 11, 2019

I'd consider the gauges the first "content" since they change on each run. Jumping past them doesn't seem to align with the idea of a "skip link" IMO.

If we don't want to stretch "content" into "first most interesting content", then OK we shouldn't do any of this.

Relatedly, when I flip on voiceover on my mac, I do see that our tools menu items are focusable when invisible. The general keyboard interaction with the tools menu seems a little atypical. If we want to improve the a11y of browsing our report, I think that'd be a good fix.

add it to #9183!

It was done here: #9169. Maybe the PR was not synced to master when you looked at this now deployment?

@brendankenny brendankenny deleted the report-quick-tab branch June 12, 2019 00:02
@paulirish
Copy link
Member

ahhhhhhh true.

#9169 is so hot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants