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
Make header toolbar dropdown menu accessible #5897
Conversation
415df9b
to
73cf794
Compare
Rebased only the relevant changes on top of master, and also addressed code style issues discussed elsewhere. |
73cf794
to
262c38f
Compare
Rebased on master, updated folder structure to match previous PRs. |
e2599fe
to
61bc0b9
Compare
61bc0b9
to
f6a386d
Compare
* { | ||
box-sizing: border-box; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is no longer needed since you added it globally in a previous PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to clean this up later once I get done with category display page. Still have some issues to address there. But yeah, I'll remove this once I get it it.
@@ -11,26 +11,63 @@ | |||
|
|||
/* Styles for the main menu */ | |||
|
|||
.toolbar.global-menu { | |||
@include font-family-title-light(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the idea is to first bring all styling under the DS, and then improve the design afterwards.
but new font looks strange there.
It's not the new font. It's just inheriting it from one of the ancestors. I want to flush out SUI first before I address font-related stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just prefer to have a "FIXME" / "remove later" with a 'hardcoded' font in here when merging it, instead of having it "broken" in master for some time and only change to the proper font in a later PR
(we already use 3.3/master in production on a smaller instance and I don't want to give them the surprise of a "strange" font change once i deploy the latest master there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I should note that Roboto Light is most certainly not the appropriate font for this use case. In fact, any "Light" font is not a good use case for normal size text (and below) in general. You may use it on larger headings, but that's a different use case. Not all font rendering engines are made the same, and light fonts generally tend to render poorly on anything that isn't a Mac.
All in all we'll need to address the font choices anyway at some point. My long-term plan after the migration to DS is complete is to pick a good font set that works well across the board in terms of readability, licensing, and also from the aesthetic perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but IMHO those "more invasive" changes are better to keep for later since we can do all the nice improvements at first without exposing users to big "oh wth why does this look completely different now?!?!" surprises :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"oh wth why does this look completely different now?!?!"
This is called a "canoe" problem. It's a temporary distraction that does not have no serious impact on usability. We generally shouldn't upgrade canoe problems into serious failures. ;)
}); | ||
}); | ||
|
||
this.addEventListener('keydown', function(ev) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evt
trigger.setAttribute('aria-expanded', trigger.getAttribute('aria-expanded') !== 'true'); | ||
}); | ||
|
||
this.addEventListener('focusout', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I prefer arrow functions for callbacks (also the ones above/below), but this one is interesting because of the this
semantics.
I think in terms of readability and maintainability (I actually had to double-check the docs how this
is used by addEventListener
) it might be better to just use arrows and put a more explicit const elem = evt.target;
(or .currentTarget
) inside the callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I prefer arrow functions for callbacks
Sure. I've switched to arrows in newer PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to update it in here as well :)
@ThiefMaster Where does this tool tip come from? Tried searching the exact text but nothing shows up. |
you find it when searching for |
Ugh, more jQuery :D |
7997604
to
4594263
Compare
4594263
to
99e4e6e
Compare
|
||
import {TipBase} from 'indico/custom_elements/TipBase'; | ||
|
||
const tipDelay = 1000; // ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels too slow. What about using something around 100-250ms? (I tested it and it feels way more reactive that way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK fair enough. 500ms feels fine as well.
(If we ever move the event creation dialog to react I could absolutely see the button to just become "Create event" and the type selection going in the dialog itself instad of being nested in a dropdown)
trigger.setAttribute('aria-expanded', trigger.getAttribute('aria-expanded') !== 'true'); | ||
}); | ||
|
||
this.addEventListener('focusout', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to update it in here as well :)
Would it be possible to open the tooltip to the right instead of to the top? For the first dropdown item it doesn't matter, but right now it's pretty much impossible to create a lecture after hovering meeting/conference - you have to move the mouse pointer outside the dropdown first so the tooltip closes, since it covers the dropdown entries above. |
Is the very dark gray ( |
As far as grays go, I think the cut-off is #737373. So yeah, we can use that. Should make for better contrast with the tooltip, too. |
let viewportWidth = document.documentElement.clientWidth; | ||
let viewportHeight = document.documentElement.clientHeight; | ||
|
||
window.addEventListener('DOMContentLoaded', () => requestIdleCallback(updateClientGeometry)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domReady.then(...);
?
const refCenter = `${referenceRect.x + referenceRect.width / 2}px`; | ||
let arrowBorder; | ||
|
||
console.log(referenceRect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove that ;)
'The <menu> element must come after <button>' | ||
); | ||
|
||
trigger.setAttribute('aria-expanded', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be 'false'
since AFAIK DOM attributes are always strings? (even though the false
is probably implicitly converted to a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's always converted to string, and that is negligible performance hit too, so you'd just waste two characters to be pedantic. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking because you (correctly) check for !== 'true'
below and I could already see a less experienced developer checking for === false
for whatever reason (after all, it's set to false
!) and wondering why it doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, what would it take for them to learn how coercion works in JavaScript?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Explicit is better than implicit." (even though that's from the zen of python and we have javascript here ;))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another saying: 'When in Rome, do as the Romans do.' This is JavaScript. Coercion is everywhere. You're not escaping that. Gotta learn at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a super strong opinion on keeping/changing it so I'll leave it up to you
I propose sticking with |
@ThiefMaster I think I got everything. Let me know if there's anything else. |
|
||
ind-with-tooltip, | ||
ind-with-toggletip { | ||
--tooltip-surface-color: #000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it cause any a11y problems if we changed this to #333
? Feels a bit very dark right now.
(Might also be personal preference, but for anything dark-mode-related I generally prefer the "dim" version over the "full black background" version, and I guess this also applies here even if it's just a tooltip)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the tooltip, I would leave it as is, because we cannot predict what ends up behind it. This way, we make sure it stands out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least right now we don't have anything darker than the menus and the meeting page background....
(so far the preference within the team is on the #333
version btw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we can always change it. I'm currently on the road. I'll get back to this later in the afternoon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed
- Correctly indicate the roles and states of the dropdown menu - Use a vanilla JavaScript implementation of the dropdown - Introduce new folders `client/{js,styles}/custom-elements` - Improve accessibility of the tooltips for the #create-* buttons
ffa945a
to
8b8c411
Compare
- Correctly indicate the roles and states of the dropdown menu - Use a vanilla JavaScript implementation of the dropdown - Improve accessibility of the tooltips for the #create-* buttons
- Correctly indicate the roles and states of the dropdown menu - Use a vanilla JavaScript implementation of the dropdown - Improve accessibility of the tooltips for the #create-* buttons
- Correctly indicate the roles and states of the dropdown menu - Use a vanilla JavaScript implementation of the dropdown - Improve accessibility of the tooltips for the #create-* buttons
- Correctly indicate the roles and states of the dropdown menu - Use a vanilla JavaScript implementation of the dropdown - Improve accessibility of the tooltips for the #create-* buttons
This patch makes the following changes:
<ind-menu>
custom element that is used to add necessaryaria-*
attributes to a combination of<button>
and<menu>
in the tollbar menuclient/{js,styles}/custom-elements
, that will be used to house Indico custom elementsind-menu
module inclient/js/index.js
See #5896
This PR requires the #5895 to be merged