In some cases in the Simpletest UI, non-collapsing fieldsets were used. Switching them to details makes it too easy to accidentally collapse them, since the click target is much better.

Before:
before-clean.png

before-results.png

After:
after-clean.png

after-results.png

Comments

sun’s picture

Status: Active » Reviewed & tested by the community
mgifford’s picture

Status: Reviewed & tested by the community » Needs work

I'm not arguing that this is something that shouldn't be collapsible. There are definitely some strange things in how browsers are implementing <details> and I do agree that this is a likely usability problem.

What we need though, I think, is a pattern to make <details> non-collapsible. Reverting to <fieldsets> is just going to make things confusing for everyone.

If what we are trying to do is visually offset an item on a page in a box, then we should be using <details>.

<fieldsets> are intended to "group related elements in a form". Fieldsets should be used with <legend> where possible to provide additional context about the relationship of the form items within the fieldset.

"The HTML element is used to group several controls as well as labels () within a web form." - Mozilla

"The fieldset element represents a set of form controls grouped under a common name." - W3C

So why are we reverting back to the hack that was implemented (maybe in Drupal 4) to use fieldsets as visual blocks for admin items on a page? Lets just fix the behavior of details using Javascript until the HTML5 spec comes up with some way to specify a non-collapsible attribute for <details>.

nod_’s picture

non collapsible details just won't happen. That's the whole point of the element. What you're describing is a fancy div.

mgifford’s picture

@nod_ even easier. Any reason not to just use a styled div tag rather than a fieldset?

sun’s picture

Status: Needs work » Reviewed & tested by the community

@mgifford:
The Simpletest module UI rarely sees any patches and has a developer audience only. Can we move your proposal into a new issue, please?

I think what you're saying makes sense though. That said, we arrived at a fairly similar conclusion over in #1829202: Make #type 'item' work outside of a form context to render a compound label + content — so perhaps we might even want to repurpose that issue, to generally replace #type details + fieldset + item throughout core with #type container + #title support, in cases where details/fieldset is not appropriate.

mgifford’s picture

This isn't a central issue and although it isn't a best practice it isn't really significant barrier either. It's more the pattern in this case I was worried about not it's application with Simpletest.

So, yes @sun thanks for the clarification and I'll try to follow-up in the other issue.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I don't mind committing this as a one-off, but I agree with mgifford that we're really sorely lacking some documentation around fieldsets vs. details and when to use what. I filed #1892968: Fieldsets vs. Details: When to use what and why? as a major follow-up task.

Committed and pushed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.