#27878 closed defect (bug) (fixed)
Custom Menu widget can't be previewed without changing a field
Reported by: | kucrut | Owned by: | markjaquith |
---|---|---|---|
Milestone: | 3.9.1 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Widgets | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
Description
Steps to reproduce
- Go to Appearance > Themes
- Click on the Customize button of the Twenty Fourteen theme
- Expand any widget area (let's use "Widgets: Primary Sidebar")
- Click on Add Widget button
- Select "Custom Menu" widget
- The widget is not added to the widget area
I believe adding "--Select--" as the first option on the Menus dropdown should solve this, because the user will be 'forced' to make an interaction to the widget form.
Attachments (2)
Change History (17)
#2
@
11 years ago
- Keywords has-patch added; needs-patch removed
27878.patch takes kucrut's suggested approach.
#3
@
11 years ago
I tested this, using the steps provided, and found the following:
Pre-patch, when adding the Custom menu widget the menu does not appear in the Sidebar and, if you only have one Custom Menu, it will only appear if you add a title to it. If you have more than one menu available and you want the first one listed then you have to switch to another menu and then switch back to the menu you actually want.
Post-patch, indeed the addition of the --Select-- option does force the user to select the menu and that triggers the action / process to refresh the preview of the theme. If, you add a title but still leave the menu option as --Select-- no menu is added (it doesn't know which one of course).
Forcing the choice seems to work logically and practically in this circumstance.
This ticket was mentioned in IRC in #wordpress-dev by nacin1. View the logs.
11 years ago
#6
@
11 years ago
- Keywords needs-patch added; has-patch removed
--Select--
isn't translated, but -- Select --
is, so we should use that.
#7
@
11 years ago
It also should have a value of 0
, to match nav-menus.php
.
src/wp-admin/nav-menus.php:623: <option value="0" selected="selected"><?php _e( '-- Select --' ); ?></option>
Repatching.
#8
follow-up:
↓ 9
@
11 years ago
- Keywords has-patch 2nd-opinion added; needs-patch removed
I like 27878.diff. Good?
#12
follow-up:
↓ 13
@
11 years ago
Existing string: "— Select —"
What's the esc_html() for?
Yes. This is a side-effect of eliminating the Submit/Update button, and not being able to auto-submit a widget's form when it is first added, because it could result in the widget form showing an error message. So either the Custom Menu widget needs to update its rendering method to use the same default menu as is pre-selected when the form is displayed, or the menu select in the form needs to start out with an empty value (as kucrut suggests, which is probably the best approach).