#33305 closed defect (bug) (fixed)
Plugin details modal: initial focus and constraining tabbing
Reported by: | afercia | Owned by: | afercia |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Plugins | Keywords: | has-patch commit |
Focuses: | ui, accessibility, javascript | Cc: |
Description
See related #28823, where the initial focus was fixed but just for the Plugins and Plugins Install screens. There are other places where users can open the Plugin detail modal and initial focus should be handled. For example the "Import" screen and the "Updates" screen (when there are plugin updates).
I'm probably missing some other screens where the Plugin modal can be opened, please comment on the ticket if you find something :)
Additionally, tabbing with the keyboard should be constrained within the modal, which is a bit more complicated then usual since it uses an iframe.
Attachments (6)
Change History (23)
#3
follow-up:
↓ 6
@
9 years ago
- Keywords reporter-feedback removed
:) Thanks @mehulkaklotar that's a good start. Was thinking to implement also some features that are used in (most) of the modal dialogs in the admin, and some general best practices, for example:
- to avoid that long pile of selectors maybe we could use a specific CSS class on all the links which open the Plugin details dialog (see for example [32645])
- all those links should also have a
data-title
attribute to hold the Plugin name, for use by JavaScript in the dialog - get and store a reference of the control which opened the dialog
- set a proper ARIA role and attributes on the modal dialog
- constrain the navigation with the tab key within the dialog
- close the modal when pressing Escape or clicking on the overlay
- the Close button should be... a button
- when closing the dialog, set focus back to the control that had focus
- special case: the Network Admin Themes screen, I think we can't do much here other than moving the initial focus on the Close button
#4
@
9 years ago
- Keywords has-patch added
First pass, trying to implement all the points above. Any thoughts more than welcome.
#6
in reply to:
↑ 3
;
follow-up:
↓ 10
@
9 years ago
Replying to afercia:
- special case: the Network Admin Themes screen, I think we can't do much here other than moving the initial focus on the Close button
Definitely can't remember what I meant with this :)
#7
@
9 years ago
- Milestone changed from Awaiting Review to 4.5
Refreshed patch. A bit more complicated than I thought. Turns out When the "Install" button is disabled, e.g. the Plugin is already installed:
then we can't predict where the last focusable element is. We need to get it each time the active tab panel changes and re-assign events each time. Everything seems to work properly now, would appreciate some testing :)
#8
@
9 years ago
Refreshed patch with some cleaning and (hopefully) some improvements. Removed some JavaScript that seems no more useful, was used to set the color and the text on the old modal "title bar" see screenshot:
The iframe title gets the name from the link data-title
attribute but not all the links that open the plugin modal have this attribute, see below (same thing happens in the Import screen, in the Dashboard, etc.):
Thus, when clicking on a link without the data-title
attribute, a string undefined
is injected in the HTML:
The refactored JavaScript covers this case now, maybe worth considering to audit all the links that open the plugin modal and add the missing attribute. Should go in a separate ticket though.
Note about IE 8: to properly set focus back when closing the modal, it would need a setTimout()
but honestly I'd prefer to don't add it just to support an outdated browser.
This ticket was mentioned in Slack in #core by afercia. View the logs.
9 years ago
#10
in reply to:
↑ 6
;
follow-up:
↓ 11
@
9 years ago
Replying to afercia:
special case: the Network Admin Themes screen, I think we can't do much here other than moving the initial focus on the Close button
Definitely can't remember what I meant with this :)
The "View version X details" modal for available updates, perhaps? :) It opens an iframe with the theme page from the directory, e.g. https://wordpress.org/themes/twentysixteen/.
#11
in reply to:
↑ 10
@
9 years ago
Replying to SergeyBiryukov:
The "View version X details" modal for available updates, perhaps? :) It opens an iframe with the theme page from the directory
Probably yes since the iframe content is from another domain and no JS interaction is possible :)
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#13
@
9 years ago
- Keywords commit added
33305.3.patch looks good. Refreshed it a bit in 33305.4.patch, some chunks were rejected for update.php.
#14
@
9 years ago
Thanks @azaozz :) Refreshed patch to add the .open-plugin-details-modal
CSS class to a couple of links.
Found one more place: Dashboard > WordPress News > Popular Plugin