Skip to content

Add keyboard controls for drag and drop problems.#1394

Open
drgrice1 wants to merge 1 commit intoopenwebwork:PG-2.21from
drgrice1:accessible-drag-and-drop
Open

Add keyboard controls for drag and drop problems.#1394
drgrice1 wants to merge 1 commit intoopenwebwork:PG-2.21from
drgrice1:accessible-drag-and-drop

Conversation

@drgrice1
Copy link
Copy Markdown
Member

@drgrice1 drgrice1 commented Apr 8, 2026

This is for problmes that use the dragndrop.js JavaScript and the DragNDrop.pm module via the draggableProof.pl and draggableSubsets.pl macros.

The elements in a drag and drop list can now be focused using tab and shift-tab. Once focused the arrow keys move the elements around. If an element is moved with the keyboard controls the changes are announced in a visually hidden span. Note that drag and drop actions via the mouse cursor are not aria announced for now. I am assuming that a screen reader user would not be using the mouse for drag and drop.

There is now also a "Drag and Drop Help" button that is shown below the drag and drop lists. If pressed, help is shown describing the keyboard controls. This help can be customized by the problem.

There are new options for the macros that allow for customizing the help and associated texts. See the updated POD in the module and macros for details. Also, I don't like that there are some options that are for the DragNDrop.pm package that are passed in from the macros, but are different in the macros than in the module. Basically the first letter is upper case in the macros, but lower case in the module. So the upper case first letter variants is deprecated (but will still work with a compatibility layer). I don't like that the macros use Pascal case to begin with for options. Options should be camel case.

Note that I also made all of the texts for the drag and drop object translatable via maketext. The texts can be customized per problem as mentioned above, but if only a translation is needed there is no need for such customization.

This is for problmes that use the `dragndrop.js` JavaScript and the
`DragNDrop.pm` module via the `draggableProof.pl` and
`draggableSubsets.pl` macros.

The elements in a drag and drop list can now be focused using tab and
shift-tab.  Once focused the arrow keys move the elements around.  If an
element is moved with the keyboard controls the changes are announced in
a visually hidden span.  Note that drag and drop actions via the mouse
cursor are not aria announced for now.  I am assuming that a screen
reader user would not be using the mouse for drag and drop.

There is now also a "Drag and Drop Help" button that is shown below the
drag and drop lists.  If pressed, help is shown describing the keyboard
controls.  This help can be customized by the problem.

There are new options for the macros that allow for customizing the help
and associated texts.  See the updated POD in the module and macros for
details.  Also, I don't like that there are some options that are for
the `DragNDrop.pm` package that are passed in from the macros, but are
different in the macros than in the module.  Basically the first letter
is upper case in the macros, but lower case in the module.  So the upper
case first letter variants is deprecated (but will still work with a
compatibility layer).  I don't like that the macros use Pascal case to
begin with for options.  Options should be camel case.

Note that I also made all of the texts for the drag and drop object
translatable via `maketext`.  The texts can be customized per problem as
mentioned above, but if only a translation is needed there is no need
for such customization.
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.

1 participant