Page MenuHomePhabricator

Position of Search result is wrong hardcoded
Closed, ResolvedPublic

Description

Author: dasch

Description:
The position of search Suggestions somehow is a bit strange on other skins.
For example take a look at my maintained cavendish skin on http://www.wecowi.de
The box with sugesstions is far to right and trying to add margin does not work because mediawikis common css kills all tries.


Version: 1.21.x
Severity: minor

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:15 AM
bzimport set Reference to bz45668.
bzimport added a subscriber: Unknown Object (MLST).

<div class="suggestions"> on your website has the style attributes
"top: 86.9px; bottom: auto; width: 276px; right: 139.2px"

On en.wikipedia.org, this is:
"top: 65.1px; bottom: auto; width: 198px; right: 6.91669px"

Looks like that's the place to locate and edit, wherever that comes from?

dasch wrote:

This is generated with javascript I guess. The problem is, that this Javascript works only correct if the buttons are below the textinput because the javascript looks for the form and makes the position after this and not from the position of the textinput.

dasch wrote:

example screenshot

It's really sad, that nobody cares about such bad styled things, that prevent other developers in creating great new skins for mediawiki.

Attached:

2013-07-04_at_10.09.png (176×918 px, 29 KB)

You should be explicitly using a data-searchsuggest-expand-dir="left" (for LTR) or "right" (for RTL) attribute on your #searchInput. It's positioned in a way that's throwing off the automatic detection.

Or feel free to reopen this bug and submit a patch that will make it work in your skin and not break anything in all of the other skins it currently supports.

(In reply to comment #3)

It's really sad, that nobody cares about such bad styled things, that prevent
other developers in creating great new skins for mediawiki.

If by "great skins" you mean "your skin", then let me point out that the linked website is throwing JS errors as soonas someone visits it. I'm not going to be fixing it for you for free.

Hmmmm actually, this might be caused by you using really weird margins on <body> and $.suggestions not expecting that.

Change 72937 had a related patch set uploaded by Matmarex:
jquery.suggestions: Use document width instead of <body> width for position calculation

https://gerrit.wikimedia.org/r/72937

Change 72937 merged by TheDJ:
jquery.suggestions: Use document width instead of <body> width for position calculation

https://gerrit.wikimedia.org/r/72937

The fix seems to be causing noticeable issues, a revert was proposed: https://gerrit.wikimedia.org/r/#/c/130425/

The revert was merged, reopening.

If anyone comes up with a solution that doesn't cause bug 54091 and bug 64233, I'd love to merge it.

Skin Cavendish uses a margin on the body element https://github.com/DaSchTour/Cavendish/blob/master/resources/cavendish.css#L84

body {
	margin-left: 5%;
	margin-right: 5%;
}

Therefor https://gerrit.wikimedia.org/r/514564 should solve the problem.

Change 514564 had a related patch set uploaded (by Fomafix; owner: Fomafix):
[mediawiki/core@master] jquery.suggestions: Use .outerWidth( true ) instead of .width()

https://gerrit.wikimedia.org/r/514564

Change 514564 merged by jenkins-bot:
[mediawiki/core@master] jquery.suggestions: Use document.documentElement.clientWidth

https://gerrit.wikimedia.org/r/514564

Please verify if rMW578c8e6855ca solves the problem in skin Cavendish. As far as I see is skin Cavendish not compatible with the current version of MediaWiki.

Please verify if rMW578c8e6855ca solves the problem in skin Cavendish. As far as I see is skin Cavendish not compatible with the current version of MediaWiki.

The MediaWiki.org page says MW 1.18+, but the skin itself is not so outdated, the readme on https://github.com/DaSchTour/Cavendish says MW 1.28+. I needed to make a few small changes to get it running on MW 1.33 alpha, which I submitted here: https://github.com/DaSchTour/Cavendish/pull/27. It has some styling problems with the Echo notifications icons, but otherwise seems to work.

And with that, I can verify that your patch to jquery.suggestions fixes this problem:

BeforeAfter
image.png (980×1 px, 90 KB)
image.png (980×1 px, 90 KB)