Normalize.css: Set <summary> elements to display:list-item

Created on 2 Jul 2016  ·  10Comments  ·  Source: necolas/normalize.css

The disclosure triangle of <summary> blocks does not show in Firefox when it is set to display:block; According to the bugzilla report (linked below), this is the expected behavior. Therefore it's default setting should be set as display:list-item (CC @silverwind).

References:

bug

Most helpful comment

This is also live in v5.0.0 which has been tagged and published to npm as normalize.css.

All 10 comments

I think this is more of an GitHub bug than anything, they explicitely set summary {display:block} which causes the incorrect rendering on Firefox.

If you look at GitHub's current css source, they are using:

/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */

Ah, didn't realize that display: block is happening in normalize.css, so it's a valid issue indeed!

Thanks for letting me know, and also for the link in the spec. I’ll take care of this as soon as I can validate this in a test. Looks like the new display property will work just fine per https://developer.mozilla.org/en-US/docs/Web/CSS/display#compat-desktop (but again, testing to be sure)

Odd... the internal Firefox stylesheet (v47.0.1; resource://gre-resources/html.css) sets summary with a display:block initially. But if it is wrapped inside a <details> element, this definition applies:

details > summary::-moz-list-bullet {
  list-style-type: disclosure-closed;
  /* Prevent elements in summary being selected when clicking on the triangle. */
  -moz-user-select: none;
}

details[open] > summary::-moz-list-bullet {
  list-style-type: disclosure-open;
}

So I think the tests need to be updated.

The UA sheet looks alright for me in Firefox 49. The pref was flipped on in 49, resulting in display:list-item for details > summary, and display:block for standalone summary, presumably for compatibilty reasons.

summary {
  display: block;
}

@supports -moz-bool-pref("dom.details_element.enabled") {
  details > summary:first-of-type,
  details > summary:-moz-native-anonymous {
    display: list-item;
  }
}

<details> and <summary> will ship in Firefox 49 so the stylesheet before this version is outdated.

Firefox v49 went live yesterday!


Click me

Did you see an arrow indicator in GitHub?!

Update: Request to GitHub to update to normalize.css v4.2.0 was sent!

This is also live in v5.0.0 which has been tagged and published to npm as normalize.css.

Was this page helpful?
0 / 5 - 0 ratings