sarajw,
@sarajw@front-end.social avatar

I'm doing an accessibility ticket at work! Hooray! Couldn't be happier!

sarajw,
@sarajw@front-end.social avatar

I'm like yeehaaaaa focus styles, let's go!

sarajw,
@sarajw@front-end.social avatar

Currently a little stuck though...

I have made menu items all buttons (instead of divs 😬) so they're nice and focusable etc.

But now I have what looks a little like a select, or a listbox, which is tabbable, but not navigable via arrow keys, and not allowing option choice via typing letters.

I would eventually consider using Adobe react-aria Select for it - I'm not sure I can do that on this pass.

But a menu/listy-looking thing that isn't navigable similarly to a <select> isn't great, right?

mvsde,
@mvsde@mastodon.social avatar

@sarajw I guess it depends on context and expectations for the widget:

If the widget is an input in a form, I would expose combobox semantics and implement the corresponding keyboard support. Or use a select because it’s a lot easier.

If the items in the dropdown part are links, I would see if I can get away with a basic disclosure pattern. It can have advanced keyboard functionality with Arrow keys and Home and End to make navigation through it easier. But doesn’t have to.

sarajw,
@sarajw@front-end.social avatar

@mvsde In this case it's a choice of date ranges, or time ranges.

On choosing one, the charts and values in the page change to match the chosen date range.

I feel like it does kind of want to be a select. But it's complicated by one of the options being 'custom' which when activated, widens the whole menu thing to include a calendar where you can pick a date range.

mvsde,
@mvsde@mastodon.social avatar

@sarajw Ok, that sounds like custom combobox territory.

The transition part from choosing “custom” to showing a datepicker is definitely not the easiest to create with native HTML elements.

sarajw,
@sarajw@front-end.social avatar

@mvsde Yeeaaahhh. Of course I'm trying to leave things as much as they are as I can, or it goes into another design round trip which would take forever.

Thank you for your input on my input!

sarajw,
@sarajw@front-end.social avatar

Ok, it now is still tabbable, but also navigable with arrows just as it looks like it should be. I wonder if it's a problem to have both, or if I should nix the options from the tabbing order. Hm.

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw you want one or the other, not both. if it's indeed a menu-like interface (with menu semantics), then you should definitely implement roving tabindex.

sarajw,
@sarajw@front-end.social avatar

@hi_mayank righto. Yeah you're probably right.

I worry about making it too complicated, or worse. But already it's way better than it was (not accessible to the keyboard at all)!

Using aria-expanded and aria-controls on it. This is probably the first time I've actually been able to flex my (beginnerish) a11y coding chops.

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw aria-expanded and aria-controls only create a simple disclosure. i'm assuming you also have role=menu and role=menuitem in there?

another thing to consider is what happens to focus when the menu opens. it should generally be set on the first menu-item.

sarajw,
@sarajw@front-end.social avatar

@hi_mayank I'm wary of menu and menuitem - I gather they're often used wrong and I'm not totally up on where the line is drawn.

I could ask @yatil - fairly sure I saw him post about it today!

I've got focus landing on the currently-chosen option, when it opens.

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw i'm confused, is it a menu or not? adding arrow key navigation without menu semantics is definitely the wrong move (unless you have other semantics, like listbox/option).

@yatil is correct in that most websites do not need role=menu, but it sounds like in your case you are literally building a menu. and most dynamic websites (which make up a small portion of all websites) do have a real need for a menu pattern.

yatil,
@yatil@yatil.social avatar

@hi_mayank @sarajw I always recommend to not use menu unless it is a menu like file/edit/view/… The whole semantics are weird, roving tabindex is not the best UX for keyboard users who don’t use screen readers, and you limit yourself in what you can do in the menu.

Simple disclosures/comboboxes (opening dialogs) go a long way.

(But of course I can’t comment on this specific case.)

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank when I'm back at the work computer tomorrow is it OK if I send you both a screenshot?

You're welcome to tell me to buzz off, as I'm getting dangerously into work territory where they should start paying. I'm asking here because I'm curious and want to know this stuff for my own learning too.

yatil,
@yatil@yatil.social avatar

@sarajw @hi_mayank I’m happy to take a look.

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank 🙏 thank you!

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil I'm always confused 😅

Yes it probably is a menu. I feel like it's visually like a select, but yes it's not in a form. It's a list of date ranges for a page full of data visualisation stuff.

Point noted, will look into menu/menuitem tomorrow.

yatil,
@yatil@yatil.social avatar

@sarajw @hi_mayank Sounds like a select to me. And that would classically be a combobox (opening a listbox) to me.

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank ok! Then I'll look into those. But they can also be navigated with arrow keys, right?

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank yes they can. I'll stop asking and do more reading! Thanks both :)

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw @yatil it sounds like you want a listbox (which is just a fancy name for select), rather than a menu?

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil glad you both agree! :)

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw @yatil you might want to read Adrian's post, where he attempts to disambiguate the various confusingly similar patterns: https://adrianroselli.com/2023/05/be-careful-using-menu.html

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil ah yes that's good. I think the listbox role probably is correct - I'm slightly confused about combobox still - as that seems to technically be a listbox with a text input at the top?

Ahaaaa now reading mdn - combobox looks like the one. It doesn't always have to have a text input: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil thank you both of you 🥰 :a11y:

hi_mayank,
@hi_mayank@hachyderm.io avatar

@sarajw @yatil yea, combobox is the "trigger" part of it.

i generally do &lt;div tabindex=0 role="combobox"&gt; for a custom select, and &lt;input role="combobox"&gt; for the filterable input.

last time i did this, i had some difficulties when labeling a &lt;button role="combobox"&gt; using aria-labelledby. but you might be fine with a button if you don't need to separately show the label and the "selected" value.

tbh this is also where i would probably reach for a library (provided you still test it)

yatil, (edited )
@yatil@yatil.social avatar

@hi_mayank @sarajw I’m currently constructing Gotham City from Lego. I would refer to the ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ but don’t use aria-activedescendent but manage the focus instead.

(And I personally would then say “that’s not worth it” and use a standard <select> 😂 but that’s not realistic in every situation.)

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank oh if only I could change the design and function, hahaha. One of these options is "custom range" and once chosen, the whole menu widens to display a date range picker.

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank can't work out if you're actually making a Lego Gotham City (if yes shoowww usss) or if that was an extended metaphor I didn't get about trying to build something complicated out of tiny pieces... Either way I'm very thankful for the input :)

yatil,
@yatil@yatil.social avatar

@sarajw @hi_mayank Nope, literally building Gotham:

hi_mayank,
@hi_mayank@hachyderm.io avatar

@yatil @sarajw i also thought it was a metaphor 😅

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil lolol it seemed kind of apt

yatil,
@yatil@yatil.social avatar

@sarajw @hi_mayank I think I’m pretty ok with English as a second language – I am not that proficient creating elaborate metaphors! 😂

anniegreens,
@anniegreens@social.lol avatar

@yatil @sarajw @hi_mayank shut the front door! I hope you write about this!

(sorry to interject, but i follow all three of you and am witnessing your convo—great convo btw!)

yatil,
@yatil@yatil.social avatar
anniegreens,
@anniegreens@social.lol avatar
sarajw,
@sarajw@front-end.social avatar

@anniegreens @yatil @hi_mayank ohhh yes. I like how it's built sort of sideways? I did wonder what the point of Lego dots was - now I see it!

yatil,
@yatil@yatil.social avatar

@sarajw @anniegreens @hi_mayank Yes, lots of what we in the biz call SNOT (studs not on top) techniques. It’s a lovely mini scale model.

sarajw,
@sarajw@front-end.social avatar
sarajw,
@sarajw@front-end.social avatar

@anniegreens @yatil @hi_mayank yes these two are being awesomely helpful without being at all patronising, feeling very privileged to have access to their big juicy brains!

sarajw,
@sarajw@front-end.social avatar

@yatil @hi_mayank oh gah that's so cool! Enjoy :) :)

mikemai2awesome,
@mikemai2awesome@mastodon.social avatar

@yatil @hi_mayank @sarajw note this example still doesn’t work well with Mac VO + safari and Android talkback + any browser.

hi_mayank,
@hi_mayank@hachyderm.io avatar

@mikemai2awesome @yatil @sarajw i don't know how they messed up this example but a select-only combobox is one of the easier patterns to implement.

in my implementation, i was using real roving focus (instead of aria-activedescendant), and it tested fine in both voiceover and talkback

mikemai2awesome,
@mikemai2awesome@mastodon.social avatar

@hi_mayank @yatil @sarajw aria-activedescendent is the problem. Safari said it’s fixed in its latest version but doesn’t look it.

sarajw,
@sarajw@front-end.social avatar
yatil,
@yatil@yatil.social avatar

@mikemai2awesome @hi_mayank @sarajw Ah, yes. That’s what one gets for giving advice distracted. 😞

sarajw,
@sarajw@front-end.social avatar

@yatil @mikemai2awesome @hi_mayank it's all good, between the 3 of you I've had plenty of good advice! I'll be experimenting with a roving tabindex later today I think...

sarajw,
@sarajw@front-end.social avatar

@hi_mayank @yatil yeah. I'm flirting with Adobe react-aria elsewhere, but I've agreed with the PO I'll do a "good enough for now" (dangerous, I know) version - as even bringing in a library and having everything hook up right and work is a bit of a task in itself.

Currently it's a button with the selected item value (the chosen time period) as its text. I did wonder if I need to add a label. Currently it only visually hints that this is changable, with a calendaresque icon before it.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • thenastyranch
  • tacticalgear
  • khanakhh
  • Youngstown
  • rosin
  • slotface
  • everett
  • vwfavf
  • ngwrru68w68
  • kavyap
  • ethstaker
  • mdbf
  • magazineikmin
  • megavids
  • Durango
  • modclub
  • InstantRegret
  • osvaldo12
  • GTA5RPClips
  • normalnudes
  • anitta
  • cubers
  • tester
  • cisconetworking
  • provamag3
  • Leos
  • JUstTest
  • All magazines