Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Spin-off from: #1852104: #type details: Remove #collapsible property
#collapsed now affects the 'open' attribute of details elements.
Negated properties/meanings are never good. Let's change that to #open TRUE/FALSE.
Related: #1839158: Replace collapse.js with a proper polyfill for <details>
Comment | File | Size | Author |
---|---|---|---|
#65 | Configure_site___Drupal_and_Configure_site___Drupal_and_Firebug_-_inactive_for_current_website_and_Library_and_Messages.png | 815.49 KB | joelpittet |
#62 | details.open_.62.patch | 73.92 KB | sun |
#59 | interdiff.txt | 717 bytes | sun |
#59 | details.open_.59.patch | 73.92 KB | sun |
#57 | details.open_.57.patch | 73.92 KB | sun |
Comments
Comment #1
nod_What's the default for #open? I'm assuming TRUE in this patch. The html5 specs only talks about the open attribute so the default state is up to whoever generates the details element.
This patch is based on the patch over at #1852104: #type details: Remove #collapsible property.
Comment #2
nod_I like #open, makes more sense to use than #collapsed :)
Comment #3
sunI'd say that #open should default to FALSE.
Normally, no #details should be opened by default, since they present "details you may skip over", by design.
Needs to use !empty() instead of
empty()
Double-space.
All of the #open = FALSE, we should simply remove.
Let's change this default value to FALSE.
Comment #4
star-szrCNW for #3, probably needs a reroll by now too.
Comment #5
nod_reroll and added fixed comments from #3
( edit ) Default state is closed. It's pretty interesting to see what it does to the admin UI :)
Comment #6
Jelle_SShould be
'#open' => TRUE,
if we want to keep the same behavior. If not, the attribute can be skipped, as you did throughout the rest of the patchEdit: nvm, I think this is where the default behavior is described... default should be closed as stated in #3
Can be skipped as done throughout the rest of the patch. Doesn't have to obviously, but we might want to go for consistency?
Besides those small remaks, patch looks sane.
Comment #7
nod_fixed.
Comment #8
nod_reroll
Comment #9
Wim LeersWhere's
#open
? :)Other than that, I couldn't find anything else to nitpick.
EDIT: nod_ pointed out that fieldsets shouldn't be collapsible anymore, so
#open
shouldn't exist there. But the second one is fortheme_details()
, and there#open
should exist :)Comment #10
Wim LeersAnd now nod_ pointed out that
theme_details()
uses#attributes['open']
… So the doxygen is correct.Comment #11
alexpottNeeds a re-roll...
Comment #12
nod_Reroll. I left one #open => TRUE for the module page details. If all details are closed, the search doesn't work.
Comment #14
nod_#12: core-details-open-attr-1892182-12.patch queued for re-testing.
Comment #15
nod_Green, back to RTBC.
Comment #16
nod_#12: core-details-open-attr-1892182-12.patch queued for re-testing.
Comment #17
yannickooDouble spaces?
Comment #18
nod_fixed the double space.
Comment #19
nod_#18: core-details-open-attr-1892182-18.patch queued for re-testing.
Comment #20
alexpottCommitted c4e52bb and pushed to 8.x. Thanks!
Comment #21
nod_Updated http://drupal.org/node/1852020 with the info.
Comment #22
tim.plunkettThis change was slightly broken, and was not manually tested.
At least not in the Views UI, one of the largest users of details.
Views UI was broken when details was introduced, and now again.
The default for #collapsed was FALSE.
The default for #open is now FALSE.
Yet they are opposites.
On top of that, anything that was '#collapsed' => TRUE, was deleted.
However, anything that did not specify #collapsed did not have #open => TRUE added.
Either:
All of the old #collapsed => TRUE should have been switched to #open => FALSE and have the default for #open to be TRUE
All of the details elements with no #collapsed should have had #open => TRUE added.
Comment #23
tim.plunkettActually this should probably be straight-up reverted. The issue title implies that one property was being renamed to another to improve DX, and yet it caused sweeping changes throughout the UI.
admin/content, admin/people, Views UI are all different. And those are just the first three I looked at.
For example, these used to be expanded:
Comment #24
xjmYeah, this is a pretty big WTF. E.g., the required fields in the installer are now hidden by default.
Comment #25
tim.plunkett@alexpott is in line to have his d.o email reset, but he reverted this.
He would have said:
"Reverted due to problems described in #22. Committed 687af78 and pushed to 8.x."
Comment #26
nod_I'll leave the pleasure or rerolling this one to someone else and the UI cleanup of form admin that should have ensued.
Comment #27
nod_whatever. It'll never get done otherwise.
Comment #28
longwaveAlmost all the #collapsed => TRUE are now #open => TRUE, but they should be #open => FALSE.
Comment #29
nod_oh yeah I got confused when I applied the patch halfway.
Comment #30
Bojhan CreditAttribution: Bojhan commented@nod Yhea, so @sun is right it should default to closed. The problem is however that its currently implemented in the opposite way, so you'd have to check all forms in core and make sure the details that where open still are and the details that are closed also are. We open some by default, because it is our only grouping pattern beside VT's (so we kinda abuse this pattern). With that in mind I would side with the rest, to leave the default open for now.
++ On the renaming :)
Comment #31
jibranif
#collapsed => TRUE
remove it.if
#collapsed => FALSE
or no#collapse
add #open => TRUE.Comment #32
nod_Thanks a lot for the reroll :)
This one is good, I guess we need tim opinion now.
Comment #33
alexpottI'm okay with the name change but I don't see why we're changing the default behaviour...
Having a fieldset open by default seems sensible to me... and the special case is when we want to add a fieldset and it default to the collapsed state.
Why not just...
if
#collapsed => TRUE
change to#open => FALSE
if
#collapsed => FALSE
remove itleave
#collapsible
well aloneand default the #open to TRUE?
Comment #34
jibran@sun has created the original patch in #1852104: #type details: Remove #collapsible property and I think only @sun can answer this question. Perhaps @nod_ can explain.
from #1852104-0
We don't need it why not remove it.
Comment #35
nod_And the point of the whole details thing was to address the fact that fieldset are overused and often misused — insert semantic argument from previous details issues — and that changing the default to closed would highlight that and there are things details are not really suited for and a uncollapsible fieldset should be used (and we can see from tim's feedback that some places would do better without the ability to be collapsible).
Defaulting to false would make contrib think about that, because it is not possible to have details element not collapsible, making sure they see it's collapse will make sure they don't miss that detail and fill bug reports about chrome not being able to not collapse details elements.
I think that's how the argument should go.
Comment #36
elachlan CreditAttribution: elachlan commentedNow that it is not defaulting to open with details. What should we use for the old fieldsets that were set to be always open?
What ever we are supposed to use the documentation should be updated to reflect that.
https://drupal.org/node/1852020
Comment #37
xjmIn general, we should either revert patches when there's a significant regression, or open separate followup issues where there's not, to avoid the confusion and staring. :) Too late for that here, so retitling for clarity, and bumping priority appropriately for #36.
Comment #38
tim.plunkettHm? This was reverted, see #25
Comment #39
xjmThanks @tim.plunkett, missed the post-on-behalf-of-committer. :)
Comment #40
nod_cross-posting #2018871: Make summary and details collapsed by default
Comment #41
sunThe default is collapsed, because HTML5 details elements are collapsed by default.
Details elements are only expanded, if you add the additional
open
attribute. That is not the default.HTML elements generated by Drupal should follow the default semantics of standard HTML elements.
In addition, as @Bojhan already mentioned in #30, the construct of "collapsible fieldsets" was intentionally replaced with native details elements. Not only because they're shiny HTML5, but also because the name "details" alone encompasses everything everyone needs to know: Details. Not Collapsible Whatnot™. Just Details. Details are not part of the 80% use-case. It is illogical to assume that details would be expanded by default.
Comment #42
tim.plunkettI don't disagree with making that the default. But the previous patch did not preserve the (possibly incorrect) behavior of core.
If someone goes through and adds
'#open' => TRUE
to every place that has no specified #collapsed while doing the conversion, I'm happy.Comment #43
nod_reroll taking care of #42.
Comment #44
jibranincludes/form.inc:2935: * Properties used: #attributes, #children, #collapsed, #description, #id,
This doc block needs update.
Comment #45
nod_thanks, fixed
Comment #46
sunThe patch generally looks good, but I do not understand why we're adding
'#open' => TRUE
to so many details.1. How many of those belong to vertical tabs or collapsibles/accordions? All of those should not be open by default, because the wrapping vertical tabs or accordions presentation can be replaced with a different or be removed altogether — also, their pre-render process automatically applies the right details + container properties to make them work for the respective visual interface component. In other words, if you temporarily comment out the library definition of vertical tabs and collapsibles/accordions, then you should see a list of regular details elements that are closed by default. Therefore,
#open
should not be declared on those.2. According to what's visible in the diff context, another small portion seems to related to details elements that additionally have a
.container-inline
class — which is a combination that is very strange to begin with. All of these details elements should probably be changed to simple fieldsets.3. The previous two points probably cover 80% of the details for which
#open
was added. The remaining ones can probably be left for a follow-up issue.Comment #47
nod_reroll.
I'm done with this patch, someone take care of it and get rid of a big Drupal-WTF please.
Comment #48
berdyshev CreditAttribution: berdyshev commentedlooks good for me
Comment #49
alexpott#48 we at least need a reason provided that this rtbc quality and can disregard @sun's comments in #46.
Comment #50
tkoleary CreditAttribution: tkoleary commented@sun
#2018871: Make summary and details collapsed by default which Nod was going to mark as a dupe is essentially the follow up. It offers a logical approach to determining what details wrappers in core should have #open and a list of them.
Comment #51
chanderbhushan CreditAttribution: chanderbhushan commented47: core-details-open-attr-1892182-47.patch queued for re-testing.
Comment #53
chanderbhushan CreditAttribution: chanderbhushan commentedApplied the patch comment #47, but its not working locally for me.
Comment #54
nod_be more specific please. what and where it's not working?
Comment #55
wundo CreditAttribution: wundo commentedComment #56
sunComment #57
sunRe-rolled against HEAD.
I super-carefully reviewed + validated every single change in this patch, and converted all new instances of #type details in HEAD.
Attached patch should be 100% correct. Interdiff wasn't possible unfortunately, since the existing patch no longer applies.
Would be great to get this in ASAP, because this is even more painful to re-roll + re-validate than the libraries.yml patch... :-/
Comment #58
fietserwinShould we rename this parameter to $open (including reversing it meaning of course)? Follow-up or in this patch: I found 2 usages, 1 of which was using the default, the other passes in a hardcoded TRUE, so the patch would only get 2 more 1-line changes (function definition line and 1 invocation line).
Should this be: $open ? '' : 'js-hide'
Assuming that @sun indeed super-carefully reviewed each change, I did not look for missed #detail elements in the Drupal core code base, I believe @sun.
I like the removal of unnecessary brackets, though 1 case was missed, but that is not a problem at all. If the 2nd point is an error this is NW and point 1 could be taken into account as well for the new patch. If point 2 is not an error, point 1 is not important enough to hold this patch, so then it is RTBC for me.
Comment #59
sunThanks, @fietserwin - well spotted!
I've to admit that I did not intensively review that particular change, because it's JS related and thus I assumed that @nod_ would have done so already ;-)
But yeah, that's the exact reason for why I do not want to rename that other
$collapsed
variable in the config_translation module here :-) That can be a trivial/novice follow-up issue.Comment #60
fietserwinRTBC for me, but needs manual testing according to one of the tags, which I didn't do.
Comment #61
joelpittetNeeds a re-roll.
Checking patch core/includes/form.inc...
error: while searching for:
// Collapsible details.
$element['#attached']['library'][] = array('system', 'drupal.collapse');
if (empty($element['#collapsed'])) {
$element['#attributes']['open'] = 'open';
}
error: patch failed: core/includes/form.inc:2063
error: core/includes/form.inc: patch does not apply
Comment #62
sunSimple diff context conflict. No interdiff.
Please note that I'm only able to guarantee a correct conversion of details elements for the state of core/HEAD on February 23, 2014. Any details elements introduced after this date are not covered, because it means hours of work to find all instances and double-check whether a particular instance has been converted already or not.
I actually do not think that this needs extensive manual testing, aside from a quick verification of some samples throughout core. In case there will be any regressions, it will be much easier to fix them in a quick/novice follow-up patch.
Draft change notice: https://drupal.org/node/2204131
Comment #63
joelpittet@sun thanks for the re-roll.
I went through and the diff looks very thorough. Gave it a simple test manual test. There looks like there are regressions for a couple collapsible fieldsets that haven't been converted but not due to this patch and if anything this patch helps that a bit in a couple cases. I think this is ready to go and cleans up the collapsible/collapsed/open intermediate stage greatly.
RTBC IMO.
Comment #64
fietserwin#63: Perhaps it would be better to list these cases that you found during testing and perhaps even already create a follow-up for it. This might make acceptance of this patch easier.
Comment #65
joelpittet@fietserwin good call, because I'll likely forget:S
On the install screen during simplytest.me install using 8-alpha8 vs 8.x + patch.
This one stood out:
Comment #66
sunThat's a different bug and not caused by this patch — see #2193271: Remove default #size attribute from core
That particular page of the installer does not use details elements anymore.
Comment #67
joelpittetGreat saves opening a duplicate:)
Comment #68
webchickSince the W3C defines this attribute as "open" it makes sense we would call it that in our code, too. Adding the "Approved API change" tag here. It does create a bit of a problem though that #type => fieldset doesn't match, so unfortunately we probably need another major task / API change to switch that one, too. Adding "needs followup" tag for that.
Patch still applies, so getting it in while it's hot.
Committed and pushed to 8.x. Thanks!
Comment #69
sun@webchick:
Not sure I understand what you mean — #type fieldset no longer supports #collapsible and #collapsed in D8 at all?
That was removed in #1852104: #type details: Remove #collapsible property already, because the entire concept of "collapsible fieldsets" is gone.
Comment #70
sunSorry, wrong issue link — that concept was removed in the original #1168246: Freedom For Fieldsets! Long Live The DETAILS.
Comment #71
webchickLOL oh. Well nevermind then. ;) Thanks.
Comment #73
wdev CreditAttribution: wdev commentedComment #74
wdev CreditAttribution: wdev commented