WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 10 days ago

#47131 assigned defect (bug)

Cursor suggests functionality even when functionality is not present

Reported by: anevins Owned by: adamsilverstein
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-screenshots wpcampus-report has-patch needs-refresh
Focuses: ui, accessibility, javascript Cc:

Description

Users who mouse over the "Save" heading on the Edit Media page see a
"move" cursor, which suggests to users that the "Save" section can
be dragged and dropped to somewhere else. However, this is only the case
if additional boxes are shown, re-ordering is not possible if "Save"
is the only visible box (although the element can be dragged, there is
nowhere else to drop it).

The use of consistent and relevant cursors may be important for users
who have a cognitive disability, since cursors give a visual clue as to
an element's functionality. Using the move cursor for elements which
cannot be moved may be confusing or counter-intuitive for users.

  • Severity:
    • Medium
  • Affected Populations:
    • Low-Vision
    • Cognitively Impaired
  • Platform(s):
    • All / Universal
  • Components affected:
    • Edit Media

Issue code

    .js .postbox .hndle, .js .widget .widget-top {


        cursor: move;


    }

Remediation Guidance
Only allow the move cursor to appear to users when re-ordering is
functionally possible.

Ideally, the drag and drop functionality should not be available at all
when only one box is present (i.e. it should not even be possible to
drag that one box), however this may be unrealistic to fix, and
therefore the solution of removing the cursor style will go a long way
towards matching user expectations.

Relevant standards
N/A

Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-78 in Tenon's report

Attachments (4)

57181541-74c8a600-6e95-11e9-9129-95cc46fe0721.jpg (75.5 KB) - added by anevins 2 months ago.
panel cursor move.png (20.6 KB) - added by afercia 7 weeks ago.
47131.diff (8.8 KB) - added by adamsilverstein 4 weeks ago.
47131.2.diff (8.8 KB) - added by adamsilverstein 4 weeks ago.

Download all attachments as: .zip

Change History (18)

#1 @anevins
2 months ago

Version 0, edited 2 months ago by anevins (next)

#2 @afercia
2 months ago

  • Component changed from General to Media

#3 @afercia
2 months ago

  • Milestone changed from Awaiting Review to 5.3

This ticket was mentioned in Slack in #core-media by anevins. View the logs.


7 weeks ago

#5 @anevins
7 weeks ago

Suggestions from the Core Media meeting: https://wordpress.slack.com/archives/C02SX62S6/p1559224344044600

  • Worth investigating whether this is the case with other metaboxes and if so to apply a wider solution.
  • It has been suggested that this may be an issue in the classic editor and not just Media. The icon/dragging shouldn’t be enabled if there’s only one metabox present.
  • In common.js I see the jQuery-UI sortables are enabled for any $sortables = $('.meta-box-sortables'), It could be as simple as checking the length of the jQuery collection and return if 1
Last edited 7 weeks ago by anevins (previous) (diff)

#6 @afercia
7 weeks ago

Testing quickly the Edit Media page, it appears things are a bit more complicated.

This page, like other pages, can be set to a 1 or 2 columns layout in the Screen Options.

  • 2 columns: I can actually move the Save meta box to the bottom of the page (though I wonder how this can be useful)
  • 1 column: there's no place where to move the Save meta box, though it's still draggable

So it appears that a logic to enable / disable the jQuery UI sortables should take into account not only the amount of meta boxes in a page but also the layout option.

Last edited 10 days ago by afercia (previous) (diff)

#7 @afercia
7 weeks ago

Worth noting the same problem happens in Gutenberg with panels added by plugins. These panels reuse the markup from the legacy meta boxes. In the core files postbox.js and common.js there's some code that targets these panels and tries to attach behaviors for the jQuery UI sortable. Also, common.css sets the cursor style to cursor: move;.

I think there's a related issue on the Gutenberg GitHub repo. See attached screenshot.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


5 weeks ago

#9 @adamsilverstein
4 weeks ago

This page, like other pages, can be set to a 1 or 3 columns layout in the Screen Options.
2 columns: I can actually move the Save meta box to the bottom of the page (though I wonder how this can be useful)
1 column: there's no place where to move the Save meta box, though it's still draggable

Based on this I am going to make meta boxes dragable if:

  • There is more than one meta box OR
  • The screen is in 2 column mode

#10 @adamsilverstein
4 weeks ago

  • Keywords has-patch added; needs-patch removed

in 47131.2.diff:

  • When the screen is in one column mode and there is only one meta box, disable sortables, otherwise enable
  • When the user toggles any screen option (columns, metas boxes) recheck and disable or enable sortables.
  • Set the cursor inline style to indicate draggability accordingly

Works well in my testing, I would appreciate some additional review.

#11 @adamsilverstein
4 weeks ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

#12 @adamsilverstein
10 days ago

@afercia if you have a chance I would appreciate a review/test of 47131.2.diff

#13 @afercia
10 days ago

  • Keywords needs-refresh added

@adamsilverstein thanks for the patch and the reminder! :)

Note: the patch doesn't apply cleanly and also modifies the package-lock.json file, because of the https / http issue. I rebuilt it locally but not uploaded here as I think it's faster for you to regenerate it keeping the Git format (I use SVN).

Seems to me it's working fine. However, I think there are other places in the admin where the same fix should be used. For example: the edit post page, both in the Classic Editor and in Gutenberg.

Searching for occurrences of .sortable( I did find at least two cases worth checking, in:
src/js/_enqueues/admin/postbox.js
and
src/js/_enqueues/wp/dashboard.js

#14 @adamsilverstein
10 days ago

Thanks for the review @afercia - I'll take a look at those other spots as well.

Note: See TracTickets for help on using tickets.