WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#35533 closed defect (bug) (fixed)

Widget reorder button in Customizer shows when only one widget

Reported by: karmatosed Owned by: westonruter
Milestone: 4.5 Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-patch
Focuses: javascript Cc:

Description (last modified by karmatosed)

If you only have one widget the reorder button shows in the Customizer. I would suggest this should only show if more than 2 as you can't really reorder just one.

https://cldup.com/DtWDgUJtla.png

Attachments (2)

35533.diff (422 bytes) - added by rabmalin 5 years ago.
35533.2.diff (475 bytes) - added by westonruter 5 years ago.

Download all attachments as: .zip

Change History (7)

#1 @karmatosed
5 years ago

  • Description modified (diff)

#2 @westonruter
5 years ago

  • Focuses javascript added
  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to 4.5
  • Version set to 3.9

This was almost done in #27787 which hid the button if the widget area was empty. So the change here would be to also hide the button if there is ≤1 widget.

@rabmalin
5 years ago

#3 @rabmalin
5 years ago

  • Keywords has-patch added

Patch added.

@westonruter
5 years ago

#4 @westonruter
5 years ago

  • Keywords good-first-bug removed

I found an edge case in 35533.diff that wasn't accounted for. The re-ordering controls for widgets don't only handle re-ordering of widgets within a sidebar, but they also provide a link to move a widget to another sidebar. So in 35533.2.diff it only hides the Reorder button if there are no widgets in the sidebar or if there is only one widget and there is only one widget area.

Make sense?

#5 @westonruter
5 years ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 36522:

Customize: Hide widgets re-order button when no re-ordering is possible.

Hide the re-order button if there are no widgets in the sidebar, or if there is there is only one sidebar and there is only one widget in the sidebar.

Props rabmalin, westonruter.
Fixes #35533.

Note: See TracTickets for help on using tickets.