Skip to content
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: design updates for internal test #7129

Merged
merged 14 commits into from
Jun 27, 2024
Merged

Conversation

shaunanoordin
Copy link
Member

@shaunanoordin shaunanoordin commented Jun 21, 2024

PR Overview

Part of: Pages Editor MVP project and FEM Lab super-project
Follows #7105
Staging branch URL: https://pr-7129.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging

This PR adds a number of small design updates, in preparation for additional internal tests. Here's the ToDo List from Slack, 10 Jun:

  • TasksPage: "Add New Task" button shouldn't take up 100% width when there are 0 tasks
  • EditStepDialog: "Add New Task" button should take up 66% of space, "Done" button should take up 33% of space
  • EditStepDialog: collapsible "Help" text box (original query from Sean: should Page only have 1 Help box? But this is a larger question, so collapsible first)
    • New behaviour: 1. "Help" fields can be collapsed & expanded. 2. a "Help" field of a Task starts off automatically expanded if EITHER the Task is the first in its Page, OR the Help field is not empty.
  • ✖️ BranchingNextPage: answers' Next Page should have "New Task" option Won't be done in this PR
  • NewTaskDialog: centre Task options
  • Teal should be 005d69
  • ⭐ project: Make Project 23976 use PageEditor links in Edit Workflow (i.e. modify /lab/workflows to automatically use /editor in links)
  • Design: dropdown menu missing carats
    • ❗ EXPLANATION: in 7105, I added select { -webkit-appearance: none } to remove a weird coloured gradient overlay on all HTML <select> dropdown elements. Unfortunately, this also removed the decorative "collapse/expand" carats/arrows on the dropdowns of EVERY browser. I've decided to ignore relatively small style issues on Safari, if the workarounds end up borking more browsers.

Status

Ready for review!

@shaunanoordin shaunanoordin requested a review from a team June 21, 2024 16:36
@coveralls
Copy link

Coverage Status

coverage: 56.991%. remained the same
when pulling 66d24fb on pages-editor-pt26
into 78699da on master.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.008%) from 56.991%
when pulling 7376979 on pages-editor-pt26
into 78699da on master.

@shaunanoordin
Copy link
Member Author

Testing Steps

Test with macOS + Chrome or Firefox. If you use Safari, please be warned that the dropdowns look gradient-ly, which is out of design.

Testing Feature update: Workflow URLs on the Workflows listing

  • View the workflows of a project that's not on the "use Pages Editor" list (example), and ensure that clicking on any example workflow DOESN'T take you to the Pages Editor page, but instead takes you to the classic PFE "Edit Workflow" page. (example)
  • View the workflows of a(/the one and only) test project that IS on the "use Pages Editor" list (example), and ensure that clicking on any example workflow DOES take you to the Pages Editor page. (example)
  • NOTE: this updated URL only works on the default workflows view, not the "reorder workflows" view.

Testing Feature update: collapsible Help fields

  • Create a new Page
  • Add a new Text/Question/Drawing Task. Observe that the Help field is automatically expanded.
  • Add two more Tasks (of any type). Observe that the Help fields for the 2nd Task onwards are automatically collapsed.
  • Click on the expand/collapse icons to expand/collapse various Help fields.
  • Open the Help field of the 3rd Task, and type in something.
  • Close the Page, then open/edit it again.
  • Observe that the following Tasks' help fields start off automatically expanded: the 1st Task on the Page (even if the Help text is empty), and the 3rd Task on the Page (because the Help text isn't empty)
    • All other Tasks' help fields start off automatically collapsed.

Testing Design updates:

<div className="flex-row spacing-bottom-S">
<label
className="big"
htmlFor={`task-${taskKey}-help`}
Copy link
Contributor

@eatyourgreens eatyourgreens Jun 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires the input to be in the DOM at all times. You can’t have a label without its corresponding input in the DOM, so the show/hide pattern used in this PR is broken. It works visually but produces a broken DOM when the text input is removed. That won’t work in a screen reader.

This needs to use a details/summary pattern, or the correct ARIA roles and state for a collapsible panel, in order to work for any users that can't physically see the task editor.

I’d also suggest using the HTML hidden boolean attribute to hide the input, rather than removing it from the DOM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the WAI-ARIA pattern for building a disclosure widget, including roles, states and keyboard interactions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, of course, you could use the native HTML disclosure widget.

Copy link
Contributor

@eatyourgreens eatyourgreens Jun 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scott O'Hara summarised the pros and cons of using a native disclosure widget vs. rolling your own in JavaScript. You can use that to make a decision as to which fits best here.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.008%) from 56.991%
when pulling d8a1927 on pages-editor-pt26
into 78699da on master.

@shaunanoordin
Copy link
Member Author

PR Update

  • Accessibility: the Help input fields, when hidden, now use <textarea hidden=true>. Thanks, Jim! 👍

@eatyourgreens
Copy link
Contributor

@shaunanoordin you're welcome. You'll still need to add the expanded state etc. to your toggle button, so that it's announced as open/closed for blind users. I'll add a comment to the PR.

@seanmiller26
Copy link

Observe that the following Tasks' help fields start off automatically expanded: the 1st Task on the Page (even if the Help text is empty), and the 3rd Task on the Page (because the Help text isn't empty)
All other Tasks' help fields start off automatically collapsed.

Interesting UX choices here. Let's see how it tests first, but I hope we can revisit the '1 Help text entry per page' discussion at a later stage to really sort this out.

1 minor styling nitpick: Can we change the Help Text header to be less bold than the Main Text/Text Task header style?

Figma:
Screenshot 2024-06-24 at 12 01 12 PM

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.03%) from 56.969%
when pulling 7bcfb06 on pages-editor-pt26
into 6703327 on master.

@eatyourgreens
Copy link
Contributor

Very minor styling point. Since you're hiding the input with hidden, maybe use a CSS animation to transition between the visible and hidden states.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.03%) from 56.969%
when pulling c19dbac on pages-editor-pt26
into 6703327 on master.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.03%) from 56.969%
when pulling c19dbac on pages-editor-pt26
into 6703327 on master.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.03%) from 56.969%
when pulling c19dbac on pages-editor-pt26
into 6703327 on master.

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.03%) from 56.969%
when pulling 55c4a95 on pages-editor-pt26
into 6703327 on master.

@shaunanoordin
Copy link
Member Author

PR Update

  • Accessibility: recommendations from Jim incorporated; expand/collapse buttons now indicate change of state via ARIA.
  • Design: "Help" field's label has been de-bolded; expand/collapse icon changed from caret (solid triangle) to angle-triangle-arrow-thing
image

👍

@coveralls
Copy link

Coverage Status

coverage: 56.999% (+0.008%) from 56.991%
when pulling 740ed7c on pages-editor-pt26
into 25a04dc on master.

@kieftrav kieftrav requested review from kieftrav and removed request for a team June 26, 2024 17:39
Copy link
Contributor

@kieftrav kieftrav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected and overall looks good to me (tested on Chrome). One strong recommendation to refactor the shared aspects of the different Tasks so as to de-duplicate code & prevent future issues if someone changes one file without knowledge of the others.

Help Text
</label>
<button
aria-label={`Show/Hide Help field`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can modify this text to be more accurate to the existing state:

${(showHelpField) ? 'Hide' : 'Show'} Help Field

Copy link
Contributor

@eatyourgreens eatyourgreens Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would change the labels to 'Show help field (closed)' and 'Hide help field (expanded)', since the ARIA expanded state is read out as part of the label. I don't think it's recommended practice to change the labels for toggles, based on the toggle state. Rather, have a single toggle button label that makes sense when accompanied by the open/closed state.

The visible label could be changed, though, for sighted users.

>
Help Text
</label>
<div className="flex-row spacing-bottom-S">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd strongly consider refactoring the shared code between DrawingTask / TextTask / QuestionTask into a file called SharedTaskFields or something like that. Without your context, I could imagine it being easy to change something in one and miss the others.

@coveralls
Copy link

Coverage Status

coverage: 56.948% (+0.008%) from 56.94%
when pulling 1f9d10d on pages-editor-pt26
into d7f9954 on master.

@coveralls
Copy link

Coverage Status

coverage: 56.948% (+0.008%) from 56.94%
when pulling 46db5b5 on pages-editor-pt26
into d7f9954 on master.

@shaunanoordin
Copy link
Member Author

Thanks Travis!

  • I've adjusted the aria-label for the Tasks accordingly. 👌
  • Agreed that the QuestionTask, DrawingTask, and TextTask need to be re-written to use shared code; the amount of repeated code in 'em is a bit ridiculous, if I'm honest.
    • For context, there was a lot of copy-pasting instead of setting up shared code, because early on, I wasn't sure which bits could be shared and which couldn't. For example, we'd think the "main text" of a task should be shared, but the question tasks use task.question while everything else uses task.instructions 🤦

@shaunanoordin shaunanoordin merged commit 4af77a2 into master Jun 27, 2024
5 checks passed
@shaunanoordin shaunanoordin deleted the pages-editor-pt26 branch June 27, 2024 16:24
@eatyourgreens
Copy link
Contributor

I've adjusted the aria-label for the Tasks accordingly.

The aria-label shouldn’t change when the button is pressed. That can make the UX confusing in a screen reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants