Postponed
Project:
Drupal core
Version:
main
Component:
Umami demo
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Jan 2018 at 14:23 UTC
Updated:
7 Oct 2019 at 06:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
andrewmacpherson commentedComment #3
andrewmacpherson commentedComment #4
andrewmacpherson commentedComment #5
andrewmacpherson commentedComment #6
andrewmacpherson commentedComment #7
ryanhayes commentedI'm gunna have a crack at this.
Comment #8
andrewmacpherson commentedComment #9
mgiffordEasy to test with here:
https://simplytest.me/project/drupal/8.6.x
The color contrast on "Super easy vegetarian pasta bake" with that pink background is borderline. Is it bigger than 18pt? http://leaverou.github.io/contrast-ratio/#white-on-%23e84265
The tab order doesn't in the header doesn't make a lot of sense for keyboard only issues either.
Comment #10
andrewmacpherson commented@mgifford This issue is just about the responsive menu.
The pink button contrast is addressed already in #2938686: Pink button/link style in Umami fails WCAG 2.0 SC 1.4.3 Contrast (minimum)
The tab order is something I already have on a list, haven't got a d.o issue for it yet. We're in the midst of moving issues from the Umami github repos to d.o
Update: the old github issue is https://github.com/lauriii/umami/issues/140
Comment #11
mgiffordThanks!
Comment #12
ryanhayes commentedI could't figure out how to create a new button with JS properly, so hopefully someone better at JS can pick that up. I added a simple conditional for the aria-expanded tags - feel like it could be more streamline though. There's a bug with adding visibility hidden to the menu and i couldn't find a way around it; on close, the menu would disappear before the animation finished.
Comment #13
ryanhayes commentedComment #14
andrewmacpherson commentedThanks for working on this @ryanhayes. I took a quick glance at the patch, and it looks like a good start. I'll take a closer look in the next few days.
It might be worth splitting this into separate issues, if some parts are going to be tricker than others. Points 2 and 3 are the most important ones, the rest could be done in follow-ups. Accessibility often involves practical compromises, and I'm happy to go for quick-wins first.
Comment #15
markconroy commentedHi Ryan and Andrew,
Been looking at this this morning and running into the same issue that Ryan has.
If we set the
<ul>todisplay:nonethen the transition is lost as you can't have transition between display types. Next, if we set the<li>to display:none instead we have the transitions working for when the menu is expanding (if we give the<li>adisplay: blockwhen then<ul>is clicked). However, when you click the menu toggle again to retract the menu, the<li>sget back theirdisplay: noneso the transition doesn't work, the menu just closes with no transition.Here's a patch that show this in action - so the links should not be available to keyboard users, but also the transition is slightly out of kilter.
I've also set the transition to
nonefor people who choose reduced motion.Comment #16
andrewmacpherson commentedThanks for working on this Mark.
re: #15...
Good idea to try
display:noneand animation properties on different elements.You could try using
visibility:noneon the list items. That also has the effect of removing them from the tabbing order, but preserves space so maybe that will make the list height animate better?Apparently some browsers don't work well with the CSS shorthand
transition: none. Using specific properties liketransition-duration: 0swould be a more robust approach. See #2940012-9: Use prefers-reduced-motion media query on batch progress bar in a related issue.I haven't tried patch #15 yet, need to wait till I'm near an Apple device.
Comment #17
markconroy commentedHere's a patch with visibilty set to
hiddenand the transition set to0sComment #18
andrewmacpherson commentedReview of patch #17....
Manual testing:
aria-expandedshould applied to the button when the page loads. NEEDS WORK.aria-controlsisn't being applied to the button. NEEDS WORK.Not manually tested yet:
prefers-reduced-motionpart. Simplytest.me environment builds were failing, and I don't have a dev server set up on my mac. The code approach looks OK in theory. GOOD, progress towards fixing point 4 from the issue summary. Still needs manual testing though.=====
Code review:
Only do this at the narrow breakpoint, the links are hidden in the wide breakpoint.
Likewise I guess this wants to move into the narrow breakpoint media query?
Why is it
visibility: inherit? Isvisibility: visiblemore reliable?The
aria-expandedandaria-controlsattributes should be initialised in JS, after finding the right elements.Need to add this code here.
+ var aria = false;constin ES6ariais a bit vague, maybe call itexpandedaria-expanded. Suggest we get the current value of one property from the DOM (aria-expanded, or a data attribute, or a class) and compute all classes and aria-expanded off that.return false;-<button type="button>doesn't have a default action to begin with. Not sure if propagation needs to be stopped?aria-label="main menu". No need to have toggle in the button name,aria-expandedwill convey that.aria-expanded="false" aria-controls="menu-main-toggle". Never initialize dynamic aria properties in the HTML source, add both of these via JS.aria-controls="menu-main-toggle"- this shouldn't point at the DIV wrapping the button. It should point to the ul.menu-main, which doesn't currently have an ID attribute.This has 2 mistakes:
aria-controlsaria-expandedattribute should go on the button only, not the list element. JS toggleMenu() isn't touching it in any case, so just remove it here.BTW never initialize dynamic ARIA states in the HTML source. Always add them via JS. Doesn't matter in this case, since we need to remove the
aria-expandedform the ULOther notes:
The default state is closed, since the
.menu-main--activeclass is not present in HTML source. This means that if JS fails to run for some reason, the main menu links will not be operable. This was discussed in the earlier github issue. The menu should be open by default with HTML + CSS, and only closed if JS runs.titleanddescelements should be removed. Could move that to a follow-up issue to review all SVG files though.Comment #19
andrewmacpherson commentedComment #20
andrewmacpherson commentedNext steps - let's split this into must-should-could priorities.
visibility:hiddento remove the links form tabbing order when menu is closed (point 2 in issue summary).DONE, works for narrow breakpoint.
NEEDS WORK: avoid hiding them at wide breakpoint, per #18.1
aria-expandedandaria-controls(point 3 in issue summary).NEEDS WORK: review in #18 identifies the mistakes.
DONE, still needs manual test to confirm.
TODO. In the earlier github issue, it was explained that this could be tricky because the CSS was built around a certain HTML pattern, so there's lots to unpick to achieve this.
titleanddescelements from the SVG icon (point 6 in issue summary). EASY, but let's review all the icons now they live in a separate folder.Right, lets fix the must-haves here, and move the rest to follow-up issues.
Comment #21
andrewmacpherson commentedTreat the must-have points from #20 as bugs.
Comment #22
andrewmacpherson commentedComment #23
andrewmacpherson commentedupdating summary, to indicate which tasks need follow-ups, vs ones already in progress or done here.
Comment #24
markconroy commentedComment #25
markconroy commentedComment #26
finnsky commentedAlso in COULD part should be added wierd animation on collapse.
https://gyazo.com/cba99932c4b273f045d5b98a92494509
Items dissapears immidiately, then menu starts to collapse.
Comment #27
finnsky commentedHi! I added patch according last notes. Now menu:
Without: https://gyazo.com/7d8e063934b76725b1d26038aa87ee2f
Comment #28
ckrinaComment #29
markconroy commentedComment #30
mgiffordIn the Proposed resolution
#2 Seems to be done.
So for #3, the patch seems to do the trick. Initially it gives:
with the patch though it gives:
Which switches to
aria-expanded="true"when expanded.I tested #4 in Safari
@media screen and (prefers-reduced-motion: reduce) {seems to be respected. This is not something supported currently in other browsers. So this is good.The rest seem to be "DEFERRED, NEEDS FOLLOW-UP ISSUE".
Comment #31
markconroy commentedThanks @mgifford.
Can we mark this issue as RTBC so? I have created follow up issues for the other items, which we can deal with one-by-one:
1 - #2973257: Create the Umami Menu Toggle Button via JS so it's not present when JS is not enabled
5 - #2973258: Place the Umami menu button inside the <nav> element
6 - #2942258: Remove unnecessary TITLE and DESC elements from Umami SVG files - deals with SVGs in general, not just the menu icon one.
Comment #32
markconroy commentedPing!
It'd be great to have this committed if someone from the ally team could mark it RTBC. I think it'd be a great win for Drupal + ally.
Comment #33
benjifisherI have not done any testing myself. I am just updating the IS based on @mgifford's comments in #30 and the issues that @markconroy referenced in #31. Since all the points in the IS have either been done (according to the review in #30) or else have follow-up issues, I think we can mark this RTBC.
Comment #35
benjifisherIt looks as though #2943107: Umami support for Internet Explorer 11 changed one line in
menu-main.css, which caused the patch to fail.The re-roll was pretty easy. I checked out the last commit before #2943107, applied the patch from #27 on this issue, and merged with the current HEAD of 8.6.x.
Comment #36
benjifisherHere is the patch I neglected to attach.
Comment #38
andrewmacpherson commentedNeeds another re-roll, patch didn't apply to 8.7.x on my machine. Working on this now.
Comment #39
andrewmacpherson commentedPatches #27 and #35 both contain the whole of patch #17 as a new file. Sounds like the re-roll approach in #35 would have missed this problem....
The patch here is another re-roll, like #35 starting from the commit before #2943107, applying #27, merging latest 8.7.x. Then I removed the stray patch #17, and made a diff.
I'll do a manual a11y review next.
Comment #41
andrewmacpherson commentedNeeded another re-roll since #2981652: [Aug. 9 2018] Format core JavaScript using recently add Prettier. Nothing's changed here except a context line in main-menu.es6.js
Comment #42
andrewmacpherson commentedThe
name="menu_toggle"attribute can be removed from the button element. This attribute is only relevant if the button is part of a form. It's not being used for anything - it's the only of instance of the "menu_toggle" string.Comment #43
andrewmacpherson commentedremoves name attribute from the button.
Comment #44
andrewmacpherson commentedThis patch is just whitespace indentation fixes, effectively a re-roll, so we don't undo the coding standards clean-up from #2983355: JS codestyle: indent.
Comment #45
andrewmacpherson commentedSome more clean-up in this patch:
toggler.classList.toggle('menu-main-toggle--active');Removing this, because it isn't used for anything. It's been there since Umami was committed to core, and this is the only place it's ever mentioned. Now
aria-expandedis the only attribute on the button which changes.This is initializing the class for the first time, so I changed it to
classList.add()for clarity.It took me a while to realize what this was doing. It looks like one-time set-up, but it's happening inside the click handler, instead of being initialized at the same time as the other attributes. This is by design, and it was explained back in comment #27:
I think this deserves a comment about why it's being done inside the click handler.
This is potentially fragile. When setting
aria-expanded, it explicitly checks what the current value is, but then it toggles the class without being sure whether it's present currently. It's important to ensure these never fall out of sync, so I replaced theclassList.toggle()with separateadd()andremove()in the if/else block. Now they're both tied to the same check.Comment #46
andrewmacpherson commentedThere's a visual bug: during the collapse animation, we briefly see a scrollbar in the UL list....
This affects all the desktop browsers we support: IE11, Edge, Firefox, Opera, Chrome, Safari (Windows, Linux, macOS versions). I also saw it on an Android/Chrome tablet, but not on phone-sized Android/iOS. It may not be apparent when testing with a Mac, because of the way the scrollbars get hidden. You can see it if you make the scroll bars visible at System Preferences > General > Show scroll bars - I think Apple's default setting is to make you guess which areas are scrollable.
The culprit is
.menu-main--collapsed { overflow-y:auto; }, which is overriding.menu-main { overflow: hidden; }. The patch here fixes it.Manual accessibility testing:
I tested this using a keyboard in all our supported desktop browsers, on macOS 10.13, Windows 7, Windows 10. I also tried it with a decent range of screen readers: NVDA 2018.2 (Win 7 + 10), JAWS 2018 (win 10), Narrator (Win 10), Voiceover (macOS), Voiceover + Safari (iOS latest), Android 8.0 + Talkback + Chrome/Firefox. Generally everything was as expected, but there were a few odd things:
This is great work - thanks @ryanhayes, @markconroy, @finnsky for working on this. The
prefers-reduced-motionis ace, and we've seen upstream issues for Firefox to implement the media query too.I think this is RTBC-worthy, but someone else will have to review my recent changes.
Comment #47
andrewmacpherson commentedI did a quick test of moving the button inside the nav region, between the H2 and UL, by editing just the
block--umami-main-menu.html.twigtemplate. As expected, some CSS changes will be needed, so it's right to defer that to #2973258: Place the Umami menu button inside the <nav> element.Comment #48
andrewmacpherson commentedI did the SVG clean-up, removed the unhelpful title and desc.
Comment #49
andrewmacpherson commentedNeeded a re-roll after #2983568: Audit and improve focus styles across the Umami theme for logged out users, it appiled cleanly with
git apply --3way. The previous issue changed a colour value in menu-main.css which was used for context in the patch.Comment #50
shaalRe: #46
On narrow screens in responsive mode there's a visual scrollbar when opening the menu (tested on Firefox and Chrome) -
Line 26 (inside the class .menu-main--active) in the file menu-main.css
from
overflow-y: auto;to
overflow-y: hidden;Is fixing the problem.
Comment #51
andrewmacpherson commented@shaal - That's exactly what I changed in patch #46.
But this introduces another problem. Using
overflow: hiddenwithmax-heightis a high accessibility risk, because content cannot be seen once it exceeds a certain height. Bizarrely, I don't think this is an explicit failure of WCAG! It doesn't fail WCAG "Focus Visible", because tabbing will cause the content of the overflow to move, (in Firefox and Chrome at least; I tested these). However sighted pointer users won't be able to access the links hidden inside the overflow, so that's definitely an accessibility and usability problem.The goal, I think, is we don't want to show the scrollbar during the brief transition, if the list content height never exceeds the max-height of the list container
ul. But if the content exceeds the max-heigh, it's essential to show provide access to links on the overflow, so we can't useoverflow: hidden;when the menu is fully open.I notice we apply the
.menu-main--transitionclass once, on the first transition, and never remove it. Maybe we can use transition start/end JS events to suppress the scrollbar during the transition.Comment #52
andrewmacpherson commentedAnother problem: using
max-height: 18.75 remaccommodates a maximum of 5 menu links. I think evaluators playing with Drupal's menus will easily exceed this when adding some pages.The menu can overflow to multiple rows at the wider breakpoints, and I found it could hold 7 one-word links on one row (in English). It would be a good idea to increase the max-height of the mobile menu to reduce the likelihood of menu links disappearing on the small breakpoints.
Comment #53
andrewmacpherson commentedThis will be a good one to work on during the Drupal Global Contribution Weekend 2019.
Comment #54
andrewmacpherson commentedThe work in #49 is RTBC worthy I think, but we can add tests. I had a go at writing some FunctionalJavascript tests for the keyboard behaviour, as a way to get some momentum for #3029206: [policy, no patch] Require functional test coverage for keyboard accessibility. These tests aren't finished yet, just uploading my progress.
Comment #56
finnsky commentedhttps://www.drupal.org/project/drupal/issues/3017176#comment-12957150
can be extended for that type of tests.
Comment #57
finnsky commentedFixed codesniffer and namespace.
Comment #58
finnsky commentedAdded [JUST FOR TEST] patch with nightwatch test.
Currently nightwatch cannot install custom installation profiles.
So test #7 patch also should be applied from here: https://www.drupal.org/project/drupal/issues/3017176#comment-12957150
Next:
Actual patch do almost same checking as core/profiles/demo_umami/tests/src/FunctionalJavascript/DemoUmamiMainMenuTest.php
Comment #59
andrewmacpherson commentedBut if we can't use nightwatch yet, why not move forward with WebDriverTestBase? This menu a11y bug is major, so I'd prefer not to postpone this for tbe nightwatch issue.
Comment #60
finnsky commented@andrewmacpherson it can be temporary drupalProfileInstall nightwatch function in umami profile until core nightwatch will support it
Comment #61
andrewmacpherson commented@finnsky - Can you elaborate on #60? I can move the WebDriverTestBase approach forward, but I don't understand the extra Nightwatch thing you mention. Is drupalInstallProfile a function name, or something else? I don't see it in your patch.
Meanwhile, the problem with the way max-height is used (#51-52) needs addressing.
Comment #62
shaalBased on patch #54, I added an improved javascript that doesn't require max-height and make the transition smoother.
This should solve #51 and #52
Comment #64
andrewmacpherson commentedThanks @shaal. Review of patch #62...
drupalInstall.jscommand if #3017176: Support install profile and language code params in drupalInstall Nightwatch command isn't fixed before this one. For now, we'll be able to use the patch there, and keep working on the Nightwatch test.Errors seen when applying the patch. Several lines have trailing whitespace, inside the new collapsSection() function in menu-main.es6.js.
collapseSection()andexpandSection()should use capitals at the start of sentences, full stops at the end, and be wrapped at 80 chars.This is a regression since patch #54. If JS is disabled, or fails to run, the menu links will not be visible, so pointer users cannot navigate the site. The links are still in the tabbing order though, which means screen reader users can navigate the site, howevere it's a failure of WCAG 2.4.7 Focus Visible for sighted keyboard users. The way the patch in #54 works, the menu will be expanded if JS fails to run, so users can still navigate the site.
The comments here are a bit hard to follow, and could be clearer. When it says "the previous style change", is that referring to the previous line which assigns
element.style.transition?This looks a bit esoteric. We're adding an event listener which apparently does nothing, except remove itself. Can you explain why it's here? My only guess is it might be there to suppress (or ensure) something elsewhere, but I can't tell what it's for by reading this snippet.
The use of
arguments.calleeis deprecated. The anonymous event listener for transitionend can be replaced with a named callback. That's good, because the name can explain the mysterious purpose in the previous point :-)Comment #65
finnsky commented@andrewmacpherson hi! please have a look at interdiff. it is actually core drupalInstall function with this https://www.drupal.org/project/drupal/issues/3017176#comment-12957150 patch applied. so we can use nightwatch with custom profile here and now.
Comment #66
shaalThis patch combines tests from #65,
This patch fixes all the issues raised in #64:
Comment #68
shaaloops. I left
console.logdebug line in the last patch.(2am coding side effects)
Comment #69
shaalComment #70
shaalRemoving saving-screenshot which was causing test to fail.
Comment #73
tim.plunkettFixing tags
Comment #79
smazAdding related issue & adding credits.
Comment #81
smazComment #83
smazComment #84
pawandubey commented@shaal
Tried to test this patch but its failed to apply. Please re-roll this patch again so we can verify it further.
Comment #85
shaalRe-rolled patch #70.
(interdiff was not possible)
Comment #86
pawandubey commented@shaal
Patch#85 works fine as per proposed resolution.
Verified menu expand and collapse working smoothly as per previous fix along with the accessibility.
Patch#85 have minor end line issue in JS file along with the commented code if ts require to remove.
Let's wait for others to provide their feedback on this and according to that you can re-roll the final one.
Comment #87
shaalComment #88
andrewmacpherson commentedThe patch still has my stub/pseudocode WebDriverTestBase approach. If we use Nightwatch, we won't need the WebDriverTestBase class.
This is on the right lines, however...
:tabbableselector, or similar approach. The point of asserting that it is tabbable is to guard against implementations of fake buttons like<div role="button" onclick="toggleMenu()">menu</div>(which isn't keyboard tabbable).keypress<code> checks for space and enter keys. The point here is to guard against implementations of fake buttons like <code><div role="button" tabindex="0" onclick="toggleMenu()">menu</div>(which is tabbable, but still isn't keyboard operable without a keypress handler), or<a role="button" href="#" onclick="toggleMenu()">menu</a>(which is tabbable, and operable with enter, but things with the button role should be operable with spacebar too).It asserts the #main-menu container is visible. But what we really want to know is that the links inside it are visible. During this issue we have encountered various problems with animating the height, and the visiblility of the overflow scrollbar, and the need to do open it in several steps. So whatever JS/CSS implementation we end up with, the desirable outcome to test is that the links themselves are visible, not their container.
Comment #89
shaalComment #90
markconroy commented@andrewmacpherson
Just by way of summary, is this issue okay for RTBC once we have those tests written? Are you okay with the actual implementation of the main menu from an accessibility standpoint?
If so, would you be able to write the tests that are needed? I'm not sure any of us on the OOTB team have experience writing Nightwatch tests?
If you could do that, then perhaps we can get someone else to RTBC this who can verify your tests.
Comment #91
smazI'm marking this as postponed until we have #3042417 finished. The idea is to use the javascript produced from that issue & try to make it a bit more generic, so it's the same code used in both places. This will make it easier to maintain & hopefully easier to test (as one test would cover everywhere the dropdown menu style is used).
Comment #92
shaalI created a global dropdown function, and an example of main-menu using that global function:
https://www.drupal.org/project/drupal/issues/3042417#comment-13288103
after language switcher gets committed, we can create copy that part of the patch to this issue.