Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty dd tags in horizontal definition list are causing wrong order #4062

Closed
kapexx opened this issue Jul 11, 2012 · 25 comments
Closed

Empty dd tags in horizontal definition list are causing wrong order #4062

kapexx opened this issue Jul 11, 2012 · 25 comments
Labels

Comments

@kapexx
Copy link

kapexx commented Jul 11, 2012

In horizontal definition lists, empty dd tags seem to have no size and are causing issues. Any dd tags following an empty one, move up so that they are displayed next to a wrong dt tag, i.e they stack on the right side, ignoring the positions of the terms.

It can be fixed by adding a clearfix:

.dl-horizontal { 
    dd { .clearfix(); }
}
@mdo
Copy link
Member

mdo commented Jul 12, 2012

That doesn't seem to fix it, nor would I expect it to. In addition, using a dl and not having a dd for your dt doesn't make much sense to me. If that fix works for you, continue to use it, however, we won't be changing it.

@mdo mdo closed this as completed Jul 12, 2012
@kapexx
Copy link
Author

kapexx commented Jul 14, 2012

Well, just as the bootstrap example shows multiple consecutive dd tags, it's also possible to use consecutive dt tags, which results in the same issue.

My empty tags are created by a cms where a user just didn't provide a description for a term. I think it's not that unusual, probably more common than multiple dd/dt tags. It implies different semantics than in the example with consecutive/omitted tags but may be easier to fix than supporting consecutive dt tags.

@BrindleFly
Copy link

Not sure why this issue is closed. Just try this simple example. You will see the "100m" appears under the dt "Shape". This can't be intentional, right?

Color:
red
Shape:
Distance:
100m

@haslinger
Copy link

@markdotto: kapep's fix actually works for me. He was not talking about a missing dd, but about an empty dd.
+1 for opening the issue again, thanx to kapep for the nice fix!

@mitfik
Copy link

mitfik commented Oct 29, 2012

Fix worked also for me. Thanks a lot.
+1 for opening the issue agian

@lamont-granquist
Copy link

just hit this bug, another +1 for re-opening it.

@lulalala
Copy link

+1 for re-opening this
related issue: #4107

@pollingj
Copy link

another +1...agree this should be fixed and the suggested fix does work

@pivotal-blueprint
Copy link

+1 here. We're having this problem, fix worked, would be awesome if this was the default behavior.

@mck-
Copy link

mck- commented Feb 12, 2013

+1 - fix worked

@jlberglund
Copy link

+1 fix worked

@arjan0307
Copy link

+1 fix worked, please re-open this.

@cvrebert
Copy link
Collaborator

I would suggest filing a new issue and including a jsFiddle this time.

@phillipp
Copy link

.dl-horizontal dd {
  min-height: 20px;
}

Works too...

@hayksaakian
Copy link

my preferred fix

 .dl-horizontal > dd:after {
    display: table;
    content: "";
    clear: both;
  }

@bloomdido
Copy link

+1

It is very common to have a list of properties where the value is nil, resulting in an empty dd element. Without this fix, .dl-horizontal will completely screw the pooch in these cases.

Is there a case where adding a clearfix() here will break something else?

@vnenkpet
Copy link

+1

This should be definitely fixed. Even if it is considered incorrect to provide an empty dd tag, this is definitely an unexpected behaviour.

mdo added a commit that referenced this issue Jun 17, 2013
Instead of clearing the entire `.dl-horizontal`, we've moved the
clearfix mixin to the `dd` level to solve two problems in one: empty
`dd`s mid-list, and empty `dd` as the last child.

Addresses a few old issues, including #2824, #3819, #3821, #4062,
#6707, and #7180.

Sorry that took so long :D.
@humbroll
Copy link

humbroll commented Jan 4, 2014

@hayksaakian nice solution!

@webprofusion-chrisc
Copy link

This does require a formal fix. Empty dd is valid html (even if not valid semantics) and should therefore have valid rendering.

The use case for this is a page displaying data for various fields, some of which have a null or empty string value. The use of dt/dd within columns makes this type of page easy to create quickly (rather than faking a read-only form etc). This page would typically then link to an Edit feature to go to a full editor.

I used the fix suggested by @hayksaakian

@cvrebert
Copy link
Collaborator

This should no longer be a problem in v3 thanks to 37f4a25.

@webprofusion-chrisc
Copy link

@cvrebert that's interesting thanks, I've prepared a jsFiddle to demonstrate using 3.1.1:
Fullscreen: http://jsfiddle.net/52VtD/4017/embedded/result/
Code: http://jsfiddle.net/52VtD/4017/

@kapexx
Copy link
Author

kapexx commented Mar 27, 2014

@webprofusion-chrisc It worked last in 3.0.3 http://jsfiddle.net/52VtD/4025/ but doesn't in 3.1.0 any more. It seems at some point the fix 37f4a25 got broken or removed.

@hnrch02
Copy link
Collaborator

hnrch02 commented Mar 27, 2014

This was fixed in b99be29 (see this JS Bin) and will ship with the next version (see #12736).

#12753, #12756: Ensure the .clearfix is applied on .dl-horizontal dd by moving it out of the media query (Less doesn't respect :extend() within media queries).

stempler pushed a commit to stempler/bootstrap that referenced this issue Apr 11, 2014
Instead of clearing the entire `.dl-horizontal`, we've moved the
clearfix mixin to the `dd` level to solve two problems in one: empty
`dd`s mid-list, and empty `dd` as the last child.

Addresses a few old issues, including twbs#2824, twbs#3819, twbs#3821, twbs#4062,
twbs#6707, and twbs#7180.

Sorry that took so long :D.
@mizzao
Copy link

mizzao commented Jul 11, 2014

I confirm this was fixed in 3.2.0 after updating from 3.1.1.

@cvrebert
Copy link
Collaborator

Great! Locking since this is 2 years old and resolved.

@twbs twbs locked and limited conversation to collaborators Jul 11, 2014
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
Instead of clearing the entire `.dl-horizontal`, we've moved the
clearfix mixin to the `dd` level to solve two problems in one: empty
`dd`s mid-list, and empty `dd` as the last child.

Addresses a few old issues, including twbs#2824, twbs#3819, twbs#3821, twbs#4062,
twbs#6707, and twbs#7180.

Sorry that took so long :D.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests