Skip to content

report: make tools menu focus-able#9169

Merged
connorjclark merged 2 commits into
masterfrom
focus-tools-menu
Jun 11, 2019
Merged

report: make tools menu focus-able#9169
connorjclark merged 2 commits into
masterfrom
focus-tools-menu

Conversation

@connorjclark

Copy link
Copy Markdown
Collaborator

Fixes #9168.


<div class="lh-tools">
<div class="report-icon report-icon--share lh-tools__button" title="Export report">
<button class="report-icon report-icon--share lh-tools__button" title="Export report">

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If this stays div, would have to 1) use tabindex="0" and 2) wire our own key event listener so space/enter would toggle the tools menu.

height: var(--lh-tools-icon-size);
cursor: pointer;
margin-right: 5px;
/* Override default button styles. */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe add to the comment that this is an actual button element but we want to style it like a transparent div? :)

.lh-tools__button.active + .lh-tools__dropdown {
opacity: 1;
clip: rect(-1px, 187px, 242px, -3px);
visibility: visible;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

anything extra this does for us compared to opacity?

@connorjclark connorjclark Jun 10, 2019

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

visibility: none removes elements from focus consideration.

@wardpeet wardpeet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not 100% fitting the accessbility rules of a dropdown but focus works 👌.

Well done! 👏

@patrickhulce patrickhulce left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@brendankenny

Copy link
Copy Markdown
Contributor

Not 100% fitting the accessbility rules of a dropdown

...can you be more specific? :)

@wardpeet

Copy link
Copy Markdown
Collaborator

Oh sorry :) It boils down to adding aria attributes and keyboard access. Tabbing isn't the correct way to handle it if you follow the spec. You should be using arrow keys instead.

More info here:
https://www.w3.org/TR/2019/NOTE-wai-aria-practices-1.1-20190207/#menubutton
https://www.w3.org/TR/2019/NOTE-wai-aria-practices-1.1-20190207/examples/menu-button/menu-button-links.html

I don't think it's worth the effort in this PR 👍

@brendankenny

Copy link
Copy Markdown
Contributor

Ah, ok. We should fix that, though :)

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.

Tools menu steals tab focus even when collapsed

5 participants