Make file attachment thumbnail actions keyboard accessible
Review Request #10898 — Created Feb. 8, 2020 and updated
This patch enables users who are not using a mouse to take advantage of the
actions attached to file attachment thumbnails in a review request. When
a file attachment is tabbed to, the menu appears and the actions in the
menu can be tabbed back and forth using tab & shift+tab. An action can be
taken using the enter key.The implementation of the file attachment menu was slightly changed to
accomodate the new behavior. Rather than usingdisplay: none
and
display: block
for the file actions container, we useopacity: 0
and
opacity: 1
to show and hide the container. When we usedisplay: none
,
this prevents the children of the container from being tabbed to. In addition,
using padding for the shadow causes the focus ring to be wider than necessary.
By using margin, we can get a tighter and clearer focus ring with the same
shadow.
Manual testing:
- using tab & shift+tab to navigate to the file attachments, verifying that the
file actions menu is opened and that each item can be selected using the enter key
and the actions menu is closed once the thumbnail loses focusUnit tests:
- testing that the hover event is fired when a mouse is hovered over the thumbnail
- testing that the focus event is fired when the thumbnail is tabbed to
Description | From | Last Updated |
---|---|---|
This RB enables users, Should RB be "patch" or "review request"? |
|
|
We can combine this with the definition of this._$file. Note that in ES6 we also now prefer the native function.bind() … |
|
|
This should have an "Args" section documenting what e is. |
|
|
This needs an "Args:" section. |
|
|
What listens for this? |
|
Change Summary:
Finish implementation of keyboard nav in the file actions. Attach videos of previous behaviour + new behaviour and update RB description.
Summary: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||
Commit: |
|
||||||||||||
Diff: |
Revision 2 (+36 -21) |
||||||||||||
Removed Files: |
|||||||||||||
Added Files: |
Checks run (2 succeeded)
Change Summary:
Add tests
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+73 -21) |
Checks run (2 succeeded)
Change Summary:
Fix description & testing sections
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
-
-
reviewboard/static/rb/js/views/fileAttachmentThumbnailView.es6.js (Diff revision 3) We can combine this with the definition of
this._$file
. Note that in ES6 we also now prefer the nativefunction.bind()
over the underscore_.bind()
method.this._$file = this.$('.file') .focusin(this._onHoverOrFocusIn.bind(this)) .focusout(this._onHoverOrFocusOut.bind(this));
-
reviewboard/static/rb/js/views/fileAttachmentThumbnailView.es6.js (Diff revision 3) This should have an "Args" section documenting what
e
is. -
reviewboard/static/rb/js/views/fileAttachmentThumbnailView.es6.js (Diff revision 3) This needs an "Args:" section.
Change Summary:
Fix issues from review.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+81 -21) |
Checks run (2 succeeded)
-
Hi Hannah,
This looks pretty good! Watching the videos, I'll note that the selection highlight is missing behind the right and bottom edge of the menu when the download item is selected. Do we know what's happening there and why?
-
Description: |
|
---|
-
Thanks, Hannah! So I gave this patch a spin, and I noticed that it works fine on Chrome, but on Firefox, I'm unable to tab-focus within the attachment menu. Any idea what's going on there?
-
reviewboard/static/rb/js/views/fileAttachmentThumbnailView.es6.js (Diff revision 4) What listens for this?