Page MenuHomePhabricator

HTMLForm renders an unnecessary label element for elements without a label
Closed, ResolvedPublic

Description

This isn't a big problem for a div/table/raw output, as the element is "simply there" (even if it would be cleaner to not have this element at all, if it's not needed, and it isn't), but it's a bigger problem for OOUI forms. Look at the following (where the submit button is created as an element (and the default submit button is omitted):

Without JavaScript
The label creates an unnecessary gap between the input and the button
With JavaScript
The label is removed when rebuilding (~infusing) the form

If the connection is slow, the user also notices a visible rebuilding of the form, which isn't really great. As a solution, HTMLForm should simply omit the label field, if it's no label is specified. We already had something similar, where unneded elements are visible in OOUI only: T117768: OOUIHTMLForm wraps Hidden fields into a fieldset.

Event Timeline

Florian created this task.Mar 13 2016, 11:00 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 13 2016, 11:00 PM

Change 277177 had a related patch set uploaded (by Florianschmidtwelzow):
Don't add label-elements for elements that doesn't have one

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

Hmm, if the display of an element changes after it is infuses, that's also a bug.

Florian triaged this task as Normal priority.Mar 14 2016, 1:35 AM

Change 277177 merged by jenkins-bot:
Don't add label-elements for elements that doesn't have one

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

Florian closed this task as Resolved.Mar 14 2016, 4:57 PM
Florian removed a project: Patch-For-Review.