Make WordPress Core

Opened 7 months ago

#46456 new defect (bug)

Customize: widgets search shouldn't search by widgets id

Reported by: afercia Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-screenshots
Focuses: ui Cc:
PR Number:


Noticed while reviewing #28888.

When searching for available widgets in the Customiser, the search checks for matches in the widgets name, id, and description: https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/wp/customize/widgets.js?rev=44539&marks=101#L87

See [27650].

However, the widget ID isn't necessarily a good place where to search for a match:

  • IDs may change at any time
  • IDs are not supposed to have a meaning for humans
  • custom widgets added by plugins are not guaranteed to have meaningful IDs
  • the IDs of all the new media widgets contain the term "media", which can produce unexpected search results
  • more importantly, IDs can't be translated

A couple examples in the screenshot below:


On the left: When searching for the term "med", all the 4 media widgets are returned in the search results. However, only the "Video" widget has some visible text that contains the term "med". This is confusing for users, as it's not so clear why "med" returns also the Audio, Gallery, and Image widgets.

This happens because under the hood the search is made against the following strings:

Audio media_audio-1 Displays an audio player.
Gallery media_gallery-3 Displays an image gallery.
Image media_image-3 Displays an image.
Video media_video-1 Displays a video from the media library or from YouTube, Vimeo, or another provider.

On the right: When the admin interface is set to a language other than English, the search will still match the IDs and, of course, they're in English. For example, when the admin language is German, searching for "im" returns also the "Bild" widget, which doesn't have any visible text matching "im". This is only an example: the amount of potentially confusing cases is endless, considering all the available languages.

Suggest: remove the widgets ID from the search "haystack".

Change History (0)

Note: See TracTickets for help on using tickets.