The styling for <summary> on GOV.UK currently expects the focus ring to shrinkwrap the text. This works fine in Chrome, but fails in Firefox. I worked around this with some horrendous code but:
that just resets Firefox back to not shrinkwrapping, and
Having read through I started worrying that other browsers might implement the WHATWG initial styles in the future, but a different way of fixing the problem did occur to me. While we can’t use display: list-item directly, we can include the list icons directly using counters. The following example code seems to work in Firefox and Chrome at least, although it’s untested beyond that and would need a proper accessibility run through etc:
disclosure-closed and disclosure-open are the default markers used for <summary> elements. The " " just inserts an empty space inbetween the marker and the text.
The styling for
<summary>
on GOV.UK currently expects the focus ring to shrinkwrap the text. This works fine in Chrome, but fails in Firefox. I worked around this with some horrendous code but:Having read through I started worrying that other browsers might implement the WHATWG initial styles in the future, but a different way of fixing the problem did occur to me. While we can’t use
display: list-item
directly, we can include the list icons directly using counters. The following example code seems to work in Firefox and Chrome at least, although it’s untested beyond that and would need a proper accessibility run through etc:disclosure-closed
anddisclosure-open
are the default markers used for<summary>
elements. The" "
just inserts an empty space inbetween the marker and the text.Does this sound like a reasonable approach?