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

Add popover for grades in auto-grade assignments #6677

Merged
merged 1 commit into from
Sep 12, 2024
Merged

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Sep 11, 2024

Add a new component that is displayed when hovering over the grade chip, which displays what were the annotation and reply requirements, and what were met.

grade-popover-one-2024-09-12_10.51.17.mp4
grade-popover-two-2024-09-12_10.49.55.mp4

TODO

  • Implement proper accessibility. The component should be announced as a popover.
    I considered using an actual popover, but it's not fully supported by all browsers yet, and requires extra positioning logic.
    We could implement a popover component in frontend-shared and use it here, but I'll probably delay that.
    EDIT: For now I did the following:
    1. Add an aria-live region around the popover, so that it gets announced by screen readers.
    2. Add role="tooltip" to the popover itself.
    3. Make the wrapper focusable, via role="button" and tabIndex={0}, and ensure the popover is toggled on focus in/out.
  • Add tests.
  • Properly center component based on the grade chip.
    EDIT: It is not centered in the designs, only slightly to the left, so I just did that.

Testing steps

  1. Go to https://hypothesis.instructure.com/courses/319/assignments/7296, edit configuration and enable auto-grading.
  2. Click on the user menu, then select "Open dashboard".
  3. The dashboard should show the grade chips in the table.
  4. Try hovering over a grade chip, to see the tooltip.

@acelaya acelaya force-pushed the grade-popover branch 2 times, most recently from c53ab54 to a498df5 Compare September 11, 2024 14:12
Comment on lines +27 to +39
className={classnames(
'rounded inline-block font-bold px-2 py-0.5 cursor-default',
{
'bg-grade-success text-white': grade === 100,
'bg-grade-success-light text-grade-success':
grade >= 80 && grade < 100,
'bg-grade-warning-light text-grade-warning':
grade >= 50 && grade < 80,
'bg-grade-error-light text-grade-error': grade >= 1 && grade < 50,
'bg-grade-error text-white': grade === 0,
'bg-grey-3 text-grey-7': gradeIsInvalid,
},
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just added cursor-default and that messed-up the whole indentation.

@acelaya acelaya force-pushed the grade-popover branch 3 times, most recently from e5b608f to 07b3027 Compare September 12, 2024 08:49
@acelaya acelaya marked this pull request as ready for review September 12, 2024 08:52
Copy link
Member

@marcospri marcospri left a comment

Choose a reason for hiding this comment

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

Looks pretty good 👍

@acelaya acelaya merged commit 6969bce into main Sep 12, 2024
9 checks passed
@acelaya acelaya deleted the grade-popover branch September 12, 2024 12:14
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.

2 participants