-
Notifications
You must be signed in to change notification settings - Fork 40
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
[A11Y] Fix the markup and/or styles/CSS for Drop Buttons #370
Comments
You might want to take a look at https://www.drupal.org/node/1899236 Its super hairy, so its great if you find a solution for this. |
Thanks @Bojhan, that's super helpful. I'm not sure we'll go as far as that issue attempted. Rewriting drop buttons as a jQuery plugin with a completely different implementation looks like a lot of work that we don't have the resources to tackle. I was just thinking a CSS update, but perhaps there's some reason why this markup is difficult to achieve the desired result without more effort. Although if we come up with something better that is API compatible, that'd be a good fit for D8 at this point. |
I have a drop button css I can contribute. I turned the tabs of primary local tasks into a drop button. It floats right, no problem, though I wouldn't say it's perfect ltr <> rtl. It's tight (10px) without an additional chunk (50px total) of right side padding. Not sure if that extra would work in the cases described, here. |
Hi @tjdjours, thanks! The tricky part about these drop buttons is that they contain a label for the default action next to the drop-down arrow. Just a dropdown without a default option is a lot easier to accomplish, showing the first item from that dropdown and then the remaining items hidden underneath another click is challenge for this particular issue. Here's a dropbutton in the closed and open state: |
So, style it so it looks like a stylized An eg of the latter can be seen with some simple jq on this codepen. It targets an id on the Or, this codepen which doesn't smush it into a Again, looks like a |
The purpose of a dropbutton is to allow users to click the most common option (usually "Edit" or "Configure") and put the remaining options in the drop-down list (e.g. "Delete", "Clone", "Revert", etc.) On the page it's a UL currently, with the first item being the clickable choice without opening the dropdown. Using a |
Oh I see. You want them all as clickable links. My css only example with the cog allows for that. Just add another Rendered quickly via inspection, so rough eg follows. I swapped out the cog for an arrow. |
Here's another example -- http://codepen.io/andyfitz/pen/nvsjw Each of the top levels can be replaced with a link. My modification, here: http://jsbin.com/kowoxiqami <div class='menu'>
<span><a href="https://github.com">Enable</a></span>
<ul>
<li><a href='#'>Edit</a></li>
<li><a href='#'>Clone</a></li>
</ul>
</div> Gracefully degrades w/o js, too. Turns into a hover as opposed to click to open. And the link I added above works just as great. |
Yep, that's a lot closer to what we're looking for! The JS is allowed to move the DOM around as necessary (say to create the prefixed Another consideration is the accessibility of dropdown. It looks like in your example, the click handler is bound to a span, but it'll need to be an anchor tag so that it's keyboard accessible. Another challenge is ensuring it works in RTL languages (e.g. Arabic), but we can work that out in the CSS. Do you think you could take a stab at modifying the /core/misc/dropbutton.js file and css file? Or would you prefer to work in fiddles/codepens to get the proof of concept working? Of course after we get the basic functionality, we'll need to style it. |
Yeah, I'd rather fuss over it in a jsbin/codepen or whatever as opposed a pile of little style commits.
Even with the nojs hover to open fall-back? |
Yep, although it's nice to have a non-JS behavior, this is about providing accessibility to users unable to use a mouse or using a screen-reader. From the experience I've had, these users almost always have JS enabled, just like anyone else, because sites generally won't work without JS. If you use a Mac, I'd suggest turning on the full keyboard access option so that you can use the tab key to select links, then try opening/closing the menu using the keyboard only (tab to get to the right link, then hit return to "click", which should be able to open the menu). Going even further, we need to have screen readers declare that the "open arrow" will show additional options, but usually that's as easy as simply setting a title attribute on the link, but we can build/test that after we just figure out the CSS/JS. |
Ok. Well, I use linux; tab and enter works as it always has with a keybaord. I just need to remember to test it. My css only one works that way but would need the styling. Pretty sure the styling would contradict a good part of the drop pattern (with properties of click-anywhere Edit: Or, oh - negative relative positioning with a mess of inelegant css push and pull. |
Yep, that's the current pattern. Honestly our styling needs to increase the size of the arrow (or surrounding padding) so it's more finger-friendly. But that's the general idea. The first item should just be a normal link that is directly clickable, all subsequent items should be accessible after clicking the down arrow. |
Ok. Here it is. UPDATE: Cloned to one w/o mystery expiry meat - http://jsbin.com/fujora/1/ I had a look at the existing drop button. Surprised I didn't initially recognize the pattern from views edit. The markup I did is slightly different. The drop arrow isn't its own second-item
Sass/css credits again to the codepen I cited above - http://codepen.io/andyfitz/pen/nvsjw. |
...filed a separate issue for the huge gap thing as I believe I have a solution for it... |
The CSS around Drop Buttons is difficult to work with in non-table scenarios. Problems:
display: block
, causing them to fill 100% width of wherever they are.We should adjust the CSS to be inline-block for better usability in various locations that are not tables (most specifically layouts, where we use them on the content layout form).
The text was updated successfully, but these errors were encountered: