WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 2 months ago

#52157 new defect (bug)

Sidebar widget not partial refreshing for first widget add and remove

Reported by: rohitrpatil Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 5.6
Component: Customize Keywords: 2nd-opinion
Focuses: ui, performance Cc:

Description

When you add the first widget in the sidebar it's a refreshing customizer completely and not partial refreshing.

  1. Go to Customizer
  2. Go to the Widgets panel.
  3. Remove all the widgets one by one.
  4. At the last widget when you remove it, it refreshes the customizer.
  5. When adding the first widget it again refreshes the customizer.

First onward, it partially refreshing the customizer as expected.

Please find the attached video for further reference: https://a.cl.ly/WnulD9r6

I need to programmatically add the widget to the dynamic sidebar but as it is refreshing the customizer when adding the first widget to the sidebar I can not proceed with my custom CSS logic.

Please check and let me know if you need anything else.

Change History (2)

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.


2 months ago

#2 @noisysocks
2 months ago

  • Component changed from Widgets to Customize
  • Keywords 2nd-opinion added; needs-partial-refresh needs-patch removed

This is probably because the theme (Twenty Twenty-one) will not display the container that widgets appear in when there are zero widgets. Partial refresh requires that container to exist in order to work and so it falls back to a full refresh.

I don't think there's anything we can do here. Partial refresh is only designed to be best effort and we definitely want to encourage themes to not render empty containers.

Adding 2nd-opinion to double check my thinking here.

Note: See TracTickets for help on using tickets.