Page MenuHomePhabricator

mwsuggest.js: Let width of container be configurable
Closed, ResolvedPublic

Description

For AJAX search with $wgEnableMWSuggest, the width of the autosuggest box is hard-coded to be the same as the search box:

function os_createContainer(r){
...

c.style.width = s.offsetWidth+"px";

Please let this width be a system-configurable or user-configurable parameter. If a wiki has many long article titles, this limits the usefulness of the AJAX search.

Thanks.


Version: 1.13.x
Severity: enhancement

Details

Reference
bz14398

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:14 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz14398.
bzimport added a subscriber: Unknown Object (MLST).

This would look pretty sloppy. Do note that when the cursor is over a title, the full title shows in a tooltip box already.

Hmmm... I don't think it looks sloppy (we're using a larger width and 280 people are happy), and the functionality is greatly improved. Imagine looking at these dropdown results:

Star
star
star
star
star
star
star
star

They're useless until you expand the width.

Starbucks
starch
stare
starfish
stargazer
stark
...

Mousing over each one isn't a solution -- it takes tons of time. The wider dropdown lets the user visually see the right link in one second. Widening the dropdown instantly increased productivity and user happiness at my company.

Please reconsider...?

How many identical prefixes are there? And how is this happening all the time?

In a corporate wiki, it's common for many articles to begin with the same few words, say, the name of a department or a process:

Software development standards
Software development best practices
Software development workstation setup
Software development environment
Software development migration
Software development department
Software development deliverables for September 2008
etc....

Our corporate wiki has 12,000 titles and this kind of repetition happens all the time. Heck, try typing "Software develop" on en.wikipedia and you get the same result (10 lines that say "Software devel").

The first day I enabled mwsuggest functionality on our wiki, 10 users asked if I could increase the width.

Bottom line: if the dropdown width is configurable, it benefits the sites who want to configure it, and wouldn't impact anyone else who prefers the tidy-looking, search-box-sized default. Since the code involved is JavaScript, it's hard to write an extension that does this without modifying or duplicating mwsuggest.js. A global variable like $mwSuggestDropdownWidth for LocalSettings.php, set to the current width as the default, would be very helpful. (A user preference would be grand (but perhaps overkill).)

mike.lifeguard+bugs wrote:

Having it widen dynamically to fit the titles displayed (perhaps with a maximum width) would be fine if having it configurable by the user is a concern.

mike.lifeguard+bugs wrote:

(In reply to comment #3)

How many identical prefixes are there? And how is this happening all the time?

My first attempt at finding an example to show you:

Wikipedia talk:!...
Wikipedia talk:!L...
Wikipedia talk:!...
Wikipedia talk:!...
Wikipedia talk:!...
Wikipedia talk:!...
Wikipedia talk:"I...
Wikipedia talk:...

These results are 100% useless; tooltips provide a workaround, but using it 100% of the time on results such as these is unacceptable.

If this is a problem, it really shouldn't need a config var. The JS should deal with this on it's own.

rainman wrote:

I think this is a problem worth fixing. It would be nice to have adaptable width, and possibly some resizing-animation for eye candy so the user knows the variable width is not a bug. I've made an attempt in r40507.

All config vars are js variable, so they go to MediaWiki:Common.js. One might for instance want to override os_animation_steps=1 to kill all animation effects, or os_container_max_width to change max relative width.

daniel wrote:

We made the list width customizable on commons a couple of weeks ago.
http://commons.wikimedia.org/w/index.php?title=MediaWiki%3ACommon.js&diff=13309960&oldid=13295819

Dynamic resizing to adapt to the contents is a tad more work though.