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

What a drag #12396

Merged
merged 6 commits into from
Jul 4, 2024
Merged

What a drag #12396

merged 6 commits into from
Jul 4, 2024

Conversation

marcellamaki
Copy link
Member

Summary

This adds a very tiny useDrag composable (which I, with great restraint, did not fill with pop culture drag references) and uses this + some additional functions to ensure that the keyboard accessibility of the drag sort order works

Fixes the draggable items part of #12148

References

Reviewer guidance

There are two sections that should be fixed by this

Creating quiz questions, and editing section order

  1. add quiz questions OR add multiple sections
  2. use the keyboard to navigate to the draggable area. should should be able to navigate into the list of items.
  3. on focus on each "draggable" element, it switches to ^ or v carets
  4. clicking "Enter" should move the item
  5. when you reach the top or bottom item, the caret should automatically switch
  6. you should not be able to get into an error state where you try to move something "past" the top or bottom and then things break
  7. The TAB key should either switch you from ^ to v or advance you to the next item. SHIFT + TAB should move you backwards
  8. As of now the arrow keys do not do anything. future improvement

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@marcellamaki marcellamaki requested a review from rtibbles July 2, 2024 22:42
@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Jul 2, 2024
@marcellamaki marcellamaki requested a review from radinamatic July 2, 2024 23:22
@marcellamaki
Copy link
Member Author

@radinamatic - noting that there are some underlying problems here with aria labeling and overall screenreader (vs. sighted keyboard user) functionality. and we have some refactoring to do in general with the drag and drop feature. i'll be filing follow up issues for this.

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Code changes all make sense, although the composable being added to the core apiSpec seems unnecessary at this point :)

@radinamatic
Copy link
Member

radinamatic commented Jul 3, 2024

Tested in both Firefox and Chrome in Ubuntu 20.04

  1. add quiz questions OR add multiple sections ✔️
  2. use the keyboard to navigate to the draggable area. should should be able to navigate into the list of items. ✔️
  3. on focus on each "draggable" element, it switches to ^ or v carets ✔️
  4. clicking "Enter" should move the item ❗

This works correctly when the user added the titles to the sections, but fails when the sections have the default names:

Default section titles

drag-default-section-titlesmp4.mp4

Custom section titles

drag-custom-section-titles.mp4
  1. when you reach the top or bottom item, the caret should automatically switch ✔️
  2. you should not be able to get into an error state where you try to move something "past" the top or bottom and then things break ✔️
  3. The TAB key should either switch you from ^ to v or advance you to the next item. SHIFT + TAB should move you backwards ✔️
  4. As of now the arrow keys do not do anything. future improvement 👍🏽

@radinamatic
Copy link
Member

radinamatic commented Jul 3, 2024

Looks like the sections are properly reordered in the sidebar, but once the settings change has been applied, the main view still displays the old titles order (but the content of the sections did indeed change). I would expect that the main view displays the section tabs in this order Section 3, Section 2, Section 1. Or am I missing something? 🤔

Before pressing 'Apply settings' After pressing 'Apply settings'
sections-reordered-sidebar sections-not-reordered-main-view

@marcellamaki marcellamaki force-pushed the what-a-drag branch 2 times, most recently from effdce0 to 2ae41d3 Compare July 4, 2024 00:37
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Seems to be working according to my expectations, although the mouse driven drag and drop appears to have some rough edges to it still.

@rtibbles rtibbles merged commit 49b9044 into learningequality:develop Jul 4, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants