Page MenuHomePhabricator

Multiple inputboxes make page invalid due to repetitive similar id
Closed, ResolvedPublic

Description

When putting more inputboxes on page, it becomes invalid since all of them have same id="createbox". Also styling an scripting is very limited then.

http://www.mediawiki.org/wiki/Extension:Inputbox is nice example.

Suggestion: id attribute is handy, so new parameter id within <inputbox> tag would be the best solution. When id not present, no id attribute will be rendered in XHTML output.


Version: unspecified
Severity: minor
URL: http://www.mediawiki.org/wiki/Extension:Inputbox

Details

Reference
bz11777

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:00 PM
bzimport set Reference to bz11777.
Danny_B created this task.Oct 27 2007, 12:16 PM

What about createbox-0, createbox-1, etc.?

ayg wrote:

That negates all purpose of an id, probably. It should just be made a class.

-testme - the provided link (the extension description itself) is an example of page invalid because of this issue, so it's easily checkable if it's still actual since that site runs from nearby HEAD.

http://www.mediawiki.org/wiki/Extension:Inputbox

http://validator.w3.org/check?verbose=1&ss=1&uri=http%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FExtension%3AInputbox

Fixed in r60072.

Now seeing this in 1.20wmf12 with HTML5 enabled.

Example:
http://en.wikipedia.org/wiki/Wikipedia:Help_desk/Header

Note: the extension currently uses id="searchbox"

Eg. Any page that uses [[template:talk header]] (which defaults to "search=yes") and [[template:archives]] (with the non-default "search=yes") on the same page, will experience this problem.

([[Talk:American_football]] currently does. Permalink: https://en.wikipedia.org/w/index.php?title=Talk:American_football&oldid=594144478 )

Or indeed, the extension page itself as comment 4 notes.

Quiddity: Are you saying that the value of id is ignored? Because if so I think that's fixed in Gerrit change 124132

(In reply to Alex Monk from comment #8)

Quiddity: Are you saying that the value of id is ignored? Because if so I
think that's fixed in Gerrit change #124132

My comment 7 was just meant to provide a few more details and examples, and to note that the id it assigns is sometimes "searchbox", and not always (as the old comment 0 says) "createbox".

Additionally, the example at [[mw:Extension:Inputbox#Parameters]] for forcing it to use "id=bar" (3rd up from bottom) doesn't seem to be working at all. (?)

Sorry, I'm not familiar with php, and don't understand what your patchset will do!

I'm also not sure what the specific real-world repercussions are, for using an id more than once for multiple forms; I just know it's not valid HTML, and ''might'' cause problems somewhere. (Screenreaders? Just other scripts?).

(For context: I'm mainly interested in this bug, because there was a related problem with Parsoid/Flow: bug 60816 and bug 60785 have details.) HTH.

Change 124169 had a related patch set uploaded by Brian Wolff:
Avoid duplicate ids

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

d comment 0 says) "createbox".

Additionally, the example at [[mw:Extension:Inputbox#Parameters]] for
forcing it to use "id=bar" (3rd up from bottom) doesn't seem to be working
at all. (?)
Sorry, I'm not familiar with php, and don't understand what your patchset
will do!

I recently fixed (gerrit change 124132) a bug where some types of inputboxes ignore the id parameter. Its not deployed to mediawiki.org yet. In about a week it should be. The search box was also still reusing ids in some situations, comment 10 fixes that issue.

I'm also not sure what the specific real-world repercussions are, for using
an id more than once for multiple forms; I just know it's not valid HTML,
and ''might'' cause problems somewhere. (Screenreaders? Just other scripts?).

Mostly a correctness issue. The biggest issue is for a search box with namespaces checkboxes, if you click on the label text it should check the box, this bug may prevent that from working sometimes. There is the possibility to confuse some javascript (although probably would cause only minor problems). Anyone validating our html, or using a strict XML parser (I don't even know if our html is generally valid xml, so that may be a non-issue) would run into problems.

Change 124169 merged by jenkins-bot:
Avoid duplicate ids

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

Should be fixed.