-
Notifications
You must be signed in to change notification settings - Fork 75
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
Pages Editor: add Tasks page (UI only, non-functional) #6868
Conversation
The list looks fine to me. Were you navigating the page in VoiceOver, or just tabbing through focusable elements? In the first case, VO will read through the list. In the second case, it won't, just as it will be skipped for a sighted keyboard user. The BBC VoiceOver testing steps are a good guide. They're linked from all frontend monorepo PRs. |
WCAG 2.2 came out on Thursday, with a more restrictive definition of accessible drag-and-drop. TPGi has a good summary.
Accessible drag-and-drop now needs to support point-and-click, as well as keyboard controls. I think up/down buttons on individual items would pass the new criteria. I’m not sure if keyboard controls for the draggable regions would, but a keyboard alternative to order the list should still be available. |
<option disabled={true}>Choose starting test</option> | ||
</select> | ||
</div> | ||
<ul className="steps-list"> |
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.
HTML lists can be labelled, so you can label this list with either aria-label
or aria-labelledby
.
Here's an example of a list with a linked heading, from project Team pages.
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.
HTML landmarks can also be labelled, which can be useful for navigating complex pages, like these project builder pages.
Use ctrl-opt-U to open the rotor in VoiceOver, then navigate to Landmarks to see a navigable list of page landmarks.
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.
Noted; (1) I'll read up on the MDN article, and (2) add labels to the lists.
Thanks again - I wasn't aware that lists could/should be labelled.
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.
Depends how complex the page is, to be honest. Sometimes, adding extra labels to lists can make them more confusing.
Here, labelling the list as ‘edit tasks’ or ‘order tasks’ might help explain the purpose of the list.
|
||
// WARNING/TODO: this should be handling steps, not tasks | ||
function StepItem({ task, taskKey }) { | ||
if (!task || !taskKey) return null; |
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.
Return an error message, so that a future user isn't looking at a blank component slot, wondering why it didn't load?
function StepItem({ task, taskKey }) { | ||
if (!task || !taskKey) return null; | ||
|
||
const text = task.instruction; |
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.
Future work: task.instruction
is deprecated in favour of the Panoptes translations API.
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.
The APIs for individual tasks are also inconsistent. Some use task.instruction
, others use task.question
. This has been a pain point in the past.
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.
workflow.strings['tasks.T0.instruction']
is how we get the instruction text now, but that would involve updating the lab to load workflow strings.
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.
👌 Noted, I'll add Panoptes translations to the ToDo. At the very minimum for this PR though, I should at least make that const text = task.instruction || task.question || '???'
so we can see more task types when reviewing/testing.
<i | ||
aria-label="Task type: text" | ||
className="fa fa fa-file-text-o fa-fw" | ||
/> |
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 think <i>
can be labelled. Only elements with roles, like images, can be labelled.
Does VoiceOver read this label? Does it show up in the accessibility tree?
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.
Font Awesome recommends <span>
nowadays. Spans can't be labelled either, so I'm not sure what they mean by 'Accessibility' 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 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.
All said though, I'm not too fond of going back to FontAwesome - I dislike how they're gating a lot of icons behind a subscription.
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.
Testing update:
<i aria-label="Task type: text" className="fa fa-whatever" />
and<span aria-label="Task type: text" className="fa fa-whatever" />
appear to be functionally the same.- Oh, and one thing I missed - the voiceover calls it "Task type: text, EMPTY GROUP"
- Adding
role="img"
sets this to "Task type: text, image" - Adding
role="presentation"
causes the task key and task question to be read together, e.g. "T0 This is the first task"... which actually sounds good, but misses out on the task type information.
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.
Generic elements can't be labelled and won't be read out by JAWS or NVDA, the two biggest screen readers. I'm pretty sure that's in the ARIA spec, so VO is ignoring the standard here.
This relates to what I was saying about lists. Basically, labels are valid on elements that have a role.
Because the generic role is nameless, the aria-labelledby and aria-label attributes are prohibited. Because the role is generic, the aria-roledescription and aria-brailleroledescription attributes are also prohibited.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/roles/generic_role
<div className="grip-bar flex-row spacing-bottom-XS"> | ||
<GripIcon color="#A6A7A9" /> | ||
</div> |
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 should be a button, if it’s a drag handle.
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.
You could add a keyboard handler to this button, so that the cursor keys move items up and down in the list, when the drag handle is focused.
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.
Alternatively, make the whole StepItem
a focusable, draggable element that responds to the cursor keys and the active pointer. That would be trickier, since each step item contains buttons and form inputs that also need to respond to the pointer and keyboard.
An example of how that can go wrong is zooniverse/front-end-monorepo#5422.
Here's a screen recording where I navigate through the page in VoiceOver on Safari, using ctrl-opt-right arrow. Safari has better integration with VoiceOver than Chrome or Firefox, so results may differ in those browsers. I tried to go slowly, so that you can follow what I'm doing. A real user would zip through the page, and would have the speed of the reader set to 500% or more. Screen.Recording.2023-10-09.at.10.58.27.movA couple of observations:
|
Here's a second video, where I bring up the rotor (ctrl-opt-U) then use that to list all the headings, links, form controls and landmarks on the page. Finally, I select the 'main' landmark and jump to it. Hopefully this is easy to follow but ask if you have any questions. Screen.Recording.2023-10-09.at.11.07.29.mov |
Awesome, thanks Jim! 👍 Those video walkthroughs have been very helpful - I now realise my problem was that I didn't know how to navigate properly. I was tab-navigating so I ended up only seeing the focusable elements. Some follow up from your feedback:
Noted, will bring this up in the design review with Sean this week.
Noted, Sean already proposed a new design for up/down arrows.
👍 Steps/Pages list and Tasks list now have labels.
Added this to the TODO
As noted in the conversation, I'm going to change Update: this seems to work! But I'm going to look at this again
Noted, I'll look into this; I think I'll bring it up on the design revision. I assume the assumption here is that Project Owners would understand those numbers/labels from experience... but let me check that, since that's two levels of assuming on my part.
Noted; this is just a placeholder to test out the current design of a Text Task. (A pretty wonky placeholder at that - I think I should set it to disabled.) I have a feeling this will need to be revised further, as they're not supposed to be actual/functional |
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.
Small note about avoiding redundant text in titles and labels, and avoiding ARIA except where the page can't be used without it.
Overly Accessible is a good post about how adding too much extra text to a page can make it harder to use.
Co-authored-by: Jim O'Donnell <[email protected]>
Co-authored-by: Jim O'Donnell <[email protected]>
f2e511c
to
81b9b42
Compare
PR Overview
Part of: Pages Editor MVP project and FEM Lab super-project
Follow #6836
Staging branch URL: https://pr-6868.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
This PR adds the Tasks page to the Pages Editor, which should have allowed project owners to add and edit tasks. The original scope of this PR was much larger, with an attempt to make the add Tasks button actually working, but I've stripped that out due to being clunky (see Known Dev Flaw 1 below).
<li.task-item>
focusable?Status
Ready for review