Opened 4 years ago
Closed 4 years ago
#50508 closed defect (bug) (fixed)
Customize: Widgets appear "inactive" by default
Reported by: | afercia | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Customize | Keywords: | has-screenshots has-patch |
Focuses: | javascript | Cc: |
Description
This appear to be a regression in trunk. I was able to reproduce on two different machines.
- latest trunk
- no plugins active, Twenty Twenty theme
- make sure there are some Widgets added in the theme's widget areas
- go to the Customizer > Widgets > one of the widget areas e.g. the Twenty Twenty "Footer 1"
- observe all the Widgets listed in the left sidebar look "inactive" their container gets a CSS
opacity: 0.5
- observe it happens also in "reorder mode"
- all widget boxes are fully functional, they just appear "inactive" because of the opacity - they also have an insufficient color contrast
- compare with latest WordPress stable, where the listed widgets don't get the opacity
- to my understanding, the opacity should only be set on the widgets that are _not_ rendered
- something wrong appears to happen with the
widget-rendered
class, which isn't applied
See attached screenshot, from left to right:
- trunk: widgets list normal mode
- trunk: widgets list "reorder" mode
- 5.4: widgets list normal mode
Attachments (4)
Change History (9)
This ticket was mentioned in Slack in #themereview by joyously. View the logs.
4 years ago
#3
in reply to:
↑ 2
@
4 years ago
Replying to dlh:
would you mind testing 50508.diff?
Thanks for the patch! It appears to solve the immediate issue.
However, that still leaves an inconsistent structure of the rendered_sidebars
and rendered_widgets
properties:
rendered_sidebars: array(5) { [0]=> string(9) "sidebar-1" [1]=> string(9) "sidebar-2" [2]=> string(9) "sidebar-1" [3]=> string(9) "sidebar-2" [4]=> string(9) "sidebar-1" }
rendered_widgets: array(7) { ["search-2"]=> bool(true) ["recent-posts-2"]=> bool(true) ["recent-comments-2"]=> bool(true) ["archives-2"]=> bool(true) ["categories-2"]=> bool(true) ["text-2"]=> bool(true) ["meta-2"]=> bool(true) }
I think that can still lead to regressions like this in the future.
50508.2.diff attempts to bring some consistency by using the same structure for rendered_sidebars
. As a positive side effect, this also removes duplicate values:
array(2) { ["sidebar-1"]=> bool(true) ["sidebar-2"]=> bool(true) }
Since the class is final
and these properties are protected, I think there should be no backward compatibility concerns in changing the structure. Could you double check?
#4
@
4 years ago
Makes sense to me. The only thing I noticed was that the logic to export renderedSidebars
and renderedWidgets
assumes that every item in the respective property is set to true
, which is currently accurate in practice, but isn't guaranteed. 50508.3.diff filters out falsey values just in case.
Introduced, I think, in [47550] with the change to a strict
in_array()
check in\WP_Customize_Widgets::is_widget_rendered()
.The
rendered_widgets
property is an associative array of'widget-id' => true
, so the previous loose check was actually also incorrect — it loosely compared the widget ID totrue
. Since the widget ID is the key, a! empty()
should cover it.@afercia would you mind testing 50508.diff?