Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33578 closed defect (bug) (fixed)

Caret icon on widget title does not flip appropriately

Reported by: sdavis2702's profile sdavis2702 Owned by: chriscct7's profile chriscct7
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.9
Component: Widgets Keywords: has-patch
Focuses: ui, javascript, administration Cc:

Description

On widgets.php, collapsed widgets already positioned in a sidebar area have a downward pointing caret icon. When you expand a widget, the caret switches to pointing up. Cool.

When you go to drag an expanded widget, it collapses automatically and remains collapsed even after it is "dropped." However, once collapsed, the caret continues to point up as if the widget was expanded.

Clicking the now collapsed widget expands it again and from there, the inconsistency is corrected. This patch corrects the caret behavior the moment you start to drag an expanded widget.

Note: There are plenty of sortable elements in core and I searched hard to find other elements that use the .ui-sortable-helper class. The widgets are the only ones I found. If you know of others, please speak up.

Attachments (2)

widget-caret.diff (48.6 KB) - added by sdavis2702 9 years ago.
At the moment when the "ui-sortable-helper" class is added to the widget element that has an "open" class because it is expanded, I've removed the pre-existing "open" class.
widgets.js.diff (424 bytes) - added by mindctrl 9 years ago.
Toggles the caret closed when dragging

Download all attachments as: .zip

Change History (16)

@sdavis2702
9 years ago

At the moment when the "ui-sortable-helper" class is added to the widget element that has an "open" class because it is expanded, I've removed the pre-existing "open" class.

#1 @sdavis2702
9 years ago

  • Keywords has-patch added

#2 @westonruter
9 years ago

  • Focuses javascript added
  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 3.9

@sdavis2702: Thanks for the report. However, modifying jQuery UI's sortable.min.js isn't going to be the right approach. Instead, the changes will need to be made to widgets.js and potentially customize-widgets.js.

#3 follow-up: @sdavis2702
9 years ago

@westonruter I completely overlooked what file I was editing. Thanks. I'll shift focus to widgets.js. Just so I know how this works, I shouldn't have to do any minimizing on my end right?

#4 in reply to: ↑ 3 @SergeyBiryukov
9 years ago

Replying to sdavis2702:

Just so I know how this works, I shouldn't have to do any minimizing on my end right?

Yes, minified files should not be patched, our build tools take care of that.

There's a SCRIPT_DEBUG constant you can add to your wp-config.php file to use non-minified files.

#5 @sdavis2702
9 years ago

Thanks, @SergeyBiryukov! Already on it.

#6 @chriscct7
9 years ago

  • Focuses administration added

Possibly related:
#13524

#7 @mindctrl
9 years ago

What is the desired behavior when dropping an expanded widget? Toggle the caret and keep the widget collapsed, or return the widget to the open state?

@mindctrl
9 years ago

Toggles the caret closed when dragging

#8 @mindctrl
9 years ago

Attached patch toggles the caret and keeps the expanded widget closed/hidden when dropped. If we'd like it the other way around, let me know and I'll update the patch.

#9 @sdavis2702
9 years ago

  • Keywords has-patch added; needs-patch removed

I believe that's the desired behavior and if it's not, I think it should be.

The patch works perfectly on my end.

#10 @SergeyBiryukov
9 years ago

  • Milestone changed from Future Release to 4.4

#11 @chriscct7
9 years ago

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

#12 @chriscct7
9 years ago

  • Status changed from assigned to reviewing

#13 @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 34165:

Ensure that widget carets close when dragging an expanded widget.

Props sdavis2702, mindctrl.
Fixes #33578.

#14 @dlh
9 years ago

#31877 was marked as a duplicate.

Note: See TracTickets for help on using tickets.