For accessibility purposes, it is bad to allow a user to initiate
loading of additional threads in the navigation sidebar and then shift
focus away from the sidebar, only to have focus snap back when the
additional threads are loaded. Now, we trap focus on the loading element
as recommended by our accessibility consultant.
JIRA: FOR-238
When a user attempts to load more threads in the forum navigation
sidebar, reset the state of the world so the user can retry, and alert
the user appropriately.
AJAX requests on forums pages occasionally fail (usually when a request
to the comments service times out), but the user is not made aware of
the failure. This manifests as either the system not appearing to store
state (e.g. if an attempt to flag a post fails) or something taking
forever to load. Now, a modal will pop up to alert the user that a
request has failed and instruct them to reload the page.
In the longer term, we should fix each user gesture that results in an
AJAX call to gracefully handle a failure by resetting the state of the
world appropriately and aleritng the user.
JIRA: FOR-37
The motivation for this change is performance. The forums UI code gets
the list of users for each role and renders the staff label based on
those lists. The list for the staff role is expensive to compute because
there is no index on the is_staff attribute, and we cannot create one
because the User model is built into django.
Users with is_staff=True are still assigned the Moderator role upon
enrolling in a course, so this change will have no practical effect
except that a user who is granted staff privileges after enrolling in a
course will have to be made a Moderator in order for their posts to be
labeled.
Additionally, the UI did not use the list of users with the Student
role, so that list has been removed as well.
They now include screen reader-friendly text, have the ARIA checkbox
role, activate on keypress (for space or enter), and occur in the DOM
after the header information (title, etc.)
The "Report Misuse" div is now focusable, responds to keyboard input,
and has appropriate attributes to indicate that it is a toggle button.
This fixes FOR-201 and FOR-209.
Failed drags bring the element back to where it started; elements are
locked to the y-axis, states are represented as CSS classes for
styling, elements can be dragged across section/subsection borders,
and dragging to the top/bottom of a section Just Works™.
Needs some styling love to give visual representation of where the
dragged element will drop, though.
TODO: It'd be good to have auto expand/collapse for subsections.
Now, when the list is reset (e.g. by sorting), the first thread is
focused. When the "Load more" link is clicked, upon loading more
threads, focus moves to the thread immediately following the thread
that was previously last in the list.