Problem/Motivation
Restyle the details and accordion elements based on the Proposal: A Style Guide for Seven.
Motivation is discussed in more detail in the style guide.
The file and image fields, fieldset, details and accordion are all container elements to some degree, having a number of sub-elements in relation to one another. They all use a background tone and slightly darker border to contain these sub-elements and visually signal their grouping. They do this with as light a touch as possible while remaining distinguishable. To soften them slightly, a 2px border-radius is applied to the outer corners.
Proposed resolution
Restyle the details (fieldset) and accordion elements
User interface changes
Superficial, in line with the style guide.
API changes
n/a
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#74 | Screen Shot 2018-06-27 at 17.41.21.png | 136.66 KB | lauriii |
#74 | Screen Shot 2018-06-27 at 17.40.59.png | 107.05 KB | lauriii |
#70 | Create Article | Drupal 8.5.4 2018-06-26 11-21-14.png | 103.93 KB | Gábor Hojtsy |
#68 | 2854624-67.patch | 8.67 KB | lauriii |
#68 | interdiff.txt | 1.28 KB | lauriii |
Comments
Comment #2
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedComment #3
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedComment #4
Gábor HojtsyI was about to say this could share some styling with #2113931: File Field design update: Upload field. but the subtle inset styling from the design does not seem to be implemented there (yet?)
Comment #5
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedNo your right Gabor, I'll get that cleaned up and implemented. I'm sure we can use some recyclable styles between the two elements.
Comment #6
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedAttached is the restyling of the details and accordions sections as outline in the descriptions screenshot above.
Comment #8
chrisrockwell CreditAttribution: chrisrockwell commentedThis looks awesome! The status report uses
detail
so we'll need a separate issue to clean that up. For example:I notice the rounded corners, and the title color.
I don't think prefixes are necessary. If we do use them, shouldn't
border-radius
be at bottom of list?Comment #9
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedAhhh yes i see that now, thanks Chris. I'll take another peek and get that fixed up, I see the patch failed too so I'll have to figure out what the issue is there.
Comment #10
chrisrockwell CreditAttribution: chrisrockwell commentedComment #11
chrisrockwell CreditAttribution: chrisrockwell commentedTrying to add related issue #2857662: Update Status Report to account for Details and Accordion styling bringing fixed
Comment #12
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedA few things fixed up here for some accessibility handling while tabbing/focusing.
Also removed the redundant prefixes as noted in #8, thanks @chrisrockwell
Comment #13
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedComment #14
chrisrockwell CreditAttribution: chrisrockwell commentedNeeds a newline at end
Other than that, this looks good to me. I've tested on Simplytest with #2857662: Update Status Report to account for Details and Accordion styling bringing fixed and everything looks great!
Comment #15
yogeshmpawarUpdated patch which removes some coding standard issues of #12 & also added interdiff.
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedlauriii credited vaplas.
Comment #18
lauriii(Updating commit credit)
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commented@lauriii, thank you for caring :)
I'm added @AaronChristian's patch from #2857662: Update Status Report to account for Details and Accordion styling bringing fixed + next changes:
Because we haven't
-moz-border-radius
and-webkit-border-radius
in other part of drupal core :)+ nit reorder rules for better grouping by name.
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedHere is this patch
Comment #21
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedAwesome thanks @vaplas. Looks good to me, no issues with the patch.
Comment #22
lauriiiWe should still take care of the open @todo's
Comment #23
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedHey @laurriii is this an issue with the current patch or more related to the fact that tag's aren't fully supported in some browsers?
http://caniuse.com/#search=%3Cdetails%3E
Comment #24
lauriii@AaronChristian if the regression is introduced in this patch, we should fix it. If not, we should file another bug report for that, as long as it can be worked without committing this patch first. If we just add a todo comment, it is highly unlikely that it gets fixed.
Comment #25
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commented@lauriii, yep it looks like
<details>
components are built right into core.As far as I can see this patch doesn't make regression any worse, so I think it's safe to say this could roll out without regression being completed.
That being said, I've created another issue to handle older browser support for
<details>
.Comment #26
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedMoving back to RTBC due to the nature of the regression being a different issue.
Comment #27
lauriiiLet's create classes for details and details__summary so it is possible to use these styles for other types of elements as well. This also allows us to write better CSS.
Why do we have to use > here? We should document it with an inline comment if it is needed.
If we have created issue for this, let's remove the @todo since it is reduntant. Please reference the issue to this issue.
I think this padding should be applied more globally for details summary elements because currently summary elements that are not inside .entity-meta look a bit awkward..
Comment #28
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedAdding related issue.
Comment #29
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commented@lauriii see https://www.drupal.org/node/2862760#comment-12000939
Comment #30
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedI'm not so sure that we should add more selectors for .details & .details_summary. It looks like
core/themes/classy/css/components/collapse-processed.css
handles all the backwards compatibility for expanding/collapsing fieldsets.So long as new elements that use
<details>
and<summary>
elements are rendered as such, the regression support that has been accounted for from modernizr & the stylesheet referenced above.I've attached a new patch with the removal of the @todo, and added a comment as you suggested in #2. #4 is actually accounted for at the bottom of the
details.css
, however it doesn't need to be defined twice, so I've moved it fromentity-meta.css
over toelements.css
.Comment #31
lauriii@AaronChristian I added the classes and rewrote the CSS accordingly. This allows us to do a few clean ups which I think is nice. What do you think about this?
Comment #32
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedHey @lauriii, awesome yeah I can see the scalability of this now. Nice addition!
Patch looks good, no problems with it's application.
Comment #33
ckrinaThat's ok for me too. Both in the status page and in other places where details appear, like in node creation. Here are some screenshots (Chrome & iOS, but tested Firefox too).
Comment #34
tkoleary CreditAttribution: tkoleary at Acquia commentedOne detail. There's not enough contrast now on checkboxes and radios with the darker background:
Can be solved with this:
Which produces:
Comment #35
tkoleary CreditAttribution: tkoleary at Acquia commentedOne other thing. There'a a bug where margin is being added to the top of the page:
It's because—for some reason—html has the details class.
You can fix it with:
Or perhaps:
Both of them work. I don't know why the details class is being added to
<html>
, but there must be a good reason so I would not remove it.After these I think this can go back to RTBC.
Comment #36
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedCool thanks everyone for testing & feedback. @tkoleary, i agree the contrast is an issue. I have another issue going for restyling the checkboxes and radio buttons, these should fix the contrast problems.
Seven Style Guide: Checkboxes
Seven Style Guide: Radio Buttons
Some feedback on direction we should take would be good on the checkboxes issue I'm facing.
https://www.drupal.org/node/2856459#comment-11999010
Comment #37
alexpottI would suggest that we don't use a class name details. The class "details" is added to html because of how we have it configured. Is there any reason to add a class and not jsut theme the details element itself? I.e. do we envisage this css not applying to other details elements and do we want to apply it to things other than a details element?
Setting back to needs review to get opinions.
Comment #38
lauriiiIt is a bad practice to theme HTML tags directly since it forces that HTML tag always to have the same styles without proper variations or future support. If we would choose to style details HTML tag directly and we would have to introduce a new details element in the future, we would have to add a class for the details element, reset the default styles set for the tag and then apply any new styles.
There are few exceptions where not styling HTML tags directly would be very inconvenient (headings, paragraph etc) but even in these cases using classes would be more robust. I've themed elements directly in projects and in almost every case I've regretted it later because it makes refactoring or changing CSS more complicated than it should be.
In this case, I don't see any downsides in using classes. In my opinion, the only problem we have is to name this in a way it doesn't clash with the HTML element class.
Comment #39
lauriiiI postponed #2279049: Add a CSS animation to expanding of details elements on this one since it is applying styles that should belong to the component we are creating here.
Comment #40
alexpott@lauriii totally happy to defer to your decision here - the main point of #37 was to point out why html was having the details class added. Not targeting HTML tags directly makes sense. So now we have to come up with a good class name...
Comment #41
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commented@lauriii @alexpott, what if we went with the "accordion" approach since it resembles that sort of component.
or back to the basics...
Thoughts?
Comment #42
ben833 CreditAttribution: ben833 as a volunteer commentedI would go with accordion, because that describes what it is.
Comment #43
lauriiiI think details is the best name for the component. Why don't we just prefix details with something? For example, something like .seven-details, or .drupal-details would work. I know it's a weird pattern but I think it's also weird if we call it to something else than what it is. We could also add a @todo about renaming it back to .details after we've managed to fix the polyfill (with a link to an issue where that would be done).
Comment #44
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commented.fieldset
sounds like<fieldset>
, which is a completely different thing semantically. So<details class="fieldset">
would be a bit mixed up IMO.Accordion usually describes a group of (related?) collapsible elements, often having constraints such as only allowing one open at a time, or requiring at least one to be open. One details element on its own doesn't sound like an accordion.
.accordion
doesn't sound match any HTML5 element name, like fieldset does, but the WAI-ARIA Authoring Practices 1.1 working draft uses the term accordion to refer to a stacked set of collapsible groups.Why not generalize Seven's
.entity-meta details {}
as.accordion details {}
? The style is only used on node forms just now, but it could be used elsewhere later on. The block placement UI had a similar looking accordion sidebar during 8.x-dev, before it was changed to use a dialog.Comment #45
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedHey @andrewmacpherson, totally agree with everything you've said I pretty much reiterated everything you noted in your comment in our slack channel. Glad to see we're on the same track though!
What are everyone's thoughts on the terms "panel-set" & "panel". This sounds like it would be a bit more descriptive on what the component and sub-components entail. Also it removes the illusion of only have 1 "panel/pane" open at a given time (like "accordion" does).
Thanks for everyone's input on this issue.
Comment #46
lauriiiI'm fine with the panel. However, I still think we could revert to #43 to avoid bikeshed about the naming :)
Comment #47
tacituseu CreditAttribution: tacituseu commentedCore already uses "panel" class for those admin blocks at
/admin/config
(see:core/modules/system/templates/admin-block.html.twig
), it would make it even more confusing. ;)Comment #50
lauriiiRerolled to 8.6.x and changed the classname from
details
toseven-details
.Comment #51
lauriiiJust realized that this does make the modules page look a bit odd:
Comment #52
Anonymous (not verified) CreditAttribution: Anonymous commented#50 looks nice!
#51: what is odd, dark-blue color of the for group labels? Was it not planned for detail labels?
Comment #53
lauriii@vaplas I think the dark grey used on the rows looks a bit strange when placed on top of the other grey. Also between the rows, there's white which doesn't match with the details background color.
Here's another screenshot demonstrating all different shades of grey we have there:
Comment #54
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedThis was mentioned in the #ux Slack channel today. Could do with checking we still have focus states indicated clearly. Cross browser testing is important there, because default browser focus styles vary.
Comment #55
lauriiiThis should address my feedback on the modules page.
Comment #56
lauriiiHere's still a screenshot of the modules page after.
Comment #57
mgifford@lauriii do you have any idea why I can't install that patch on SimplyTest.me - that's generally how I quickly whip up a demo to test.
Alternatively, even posting the new HTML as a sample might be sufficient to see if it is following best practices.
Comment #58
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedReview of patch #55 follows. It introduces a regression, and I figured out why. The new
details.html.twig
template in Seven breaks thecollapse.js
polyfill.Things work fine in latest desktop versions of Chrome, Opera, Firefox. I didn't test Safari.
However in IE11 and Edge, the details/summary behaviour stopped working:
<details open>
attribute did toggle correctly, as did the aria properties fromdetails-aria.js
I reckoned it could be something to do with the
collapse.js
polyfill, which is used by IE11 and Edge. Chrome, Opera, and Safari have supported details/summary since long before D8.0.0 was released, and Firefox supported it from v49 onwards.Before Firefox 49, details/summary was experimental, and could be enabled with the
dom.details_element.enabled
preference. Old Firefox releases are still available (very cool), and sure enough, patch #55 causes a regression in Firefox 48, but enabling the experimental details/summary report made the problem go away.After lots of summary toggling and rooting around in dev tools, I found the problem. We have this rule in Stable theme's CSS, which controls whether the open details when using the polyfill:
The new
.seven-details__wrapper
in the new template doesn't match this. We can fix the regression by adding this style rule:It worked when I shoved this rule into browser dev tools. I'm pleased I caught this, I feel like a proper front-end developer today :-)
@lauriii - can you update the patch, and I'll retest?
@mgifford - maybe the simplytest.me failure you're experiencing is #2946730: Spawned instances get "The website encountered an error" message? If you get the message "The website encountered an unexpected error. Please try again later", that appears to be a timing issue while simplytest.me does a composer install. I experienced it today, and when I tried again immediately afterwards, I managed to install Drupal successfully.
Comment #59
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedForgot, I had another review point for patch #55:
I don't understand why we change the summary text colour when the details are open, but are not currently being interacted with hover or focus. That seems to diminish the usefulness of changing the colour for the hover and focus styles. The open details are already very clear, just from showing the content, and the disclosure triangle icon helps this. I suggest removing the
.seven-details[open] > .seven-details__summary
selector here, unless there's a special reason I've missed?It's not really an accessibility issue though, because we're not relying on colour to tell the states apart.
Comment #60
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedPatch #55:
What's the text-shadow for here? It's very hard to notice. The dark text colour has very good contrast against the background, so I don't understand what this text-shadow is for. It's in all the patches here, but isn't explained.
Comment #61
lauriiiThank you for the feedback! 😻It seems like there's some other styles attached to that element as well. Even though this is not the cleanest approach for solving this, I think this would be the least likely to break something.
@andrewmacpherson those design decision has been made a long time ago so it might be difficult to track down the specific reasons for those decisions.
Comment #62
lauriiiRemoving some old tags
Comment #63
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedRTBC:
The patch in #61 fixes the issues I found in #58 with the collapse.js polyfill.
I tested in IE11 (win 10), Edge (Win 10), Opera (linux, mac, win), Chrome (mac, win), Safari (mac), Safari (iOS), Chrome (Android).
Open closed box size, and disclosure triangle icon all work right.
Needs follow-up:
I noticed inconsistency with focus styles - sometimes there was a focus indicator, sometimes not. In some browsers (chrome + opera on mac) the summary element got an underline on when it was focused, but in others (safari on mac?) it didn't. I noticed this halfway though the long list of browsers, and didn't go back to check them all over again ;-)
We need a clear visual focus style for the summary element. In the case where the focused summary doesn't get an underline, the only indication is a slight colour change, which is a failure of WCAG 1.4.1 Use of Color (level A). Since the colour change on focus is so slight, it's also a failure of WCAG 2.4.7 Focus Visible and 1.4.11 Non-text contrast (both level AA).
Now, Proposal: A Style Guide for Seven doesn't actually have a focus style for the summary element. We definitely need to make summary focus visible in all browsers, so lets investigate an fix that in a follow-up.
Comment #64
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedI filed the follow-up at #2980304: Seven theme's details/summary focus style is broken/missing in some browsers.
Comment #66
Gábor HojtsyLooks like the followup was opened. Also @lauriii sent it for a retest.
Comment #67
Gábor HojtsyReviewed for commit. There are two @todo comments, the second one does not even sounds actionable. Since neither has an issue link, completing them blocks this issue. If there are issues and they are referenced in the patch (and briefly explained) then this would be good to go.
Comment #68
lauriiiGood catch! 🕵️♂️ I improved the comments and linked them to follow-up issues.
Comment #69
alexpott#67 has been done as requested.
Comment #70
Gábor HojtsyThanks! I wanted to go check what does this patch do, now that I was done with code review. This is what the issue summary suggests:
I did not expect exactly that given the lack of applying that font in core. However the issue summary says this issue is to restyle radio buttons and checkboxes. All changes that I managed to notice were that these triangles are now there. Coloring is still as before, radio buttons are still as before, etc:
Comment #71
lauriii@Gábor Hojtsy did you clear caches after applying the patch? It should indeed look like the issue summary.
Comment #72
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer and at Annertech commentedI don't see any change to the radio button styling either, testing with a brand new simplytest.me installation. Checked on latest Firefox, Chrome, Opera, Edge, and IE11; not Safari though.
In earlier testing I didn't actually realize we we changing the radio buttons; I thought it was just the details/summary elements.
Comment #73
Gábor HojtsyCheckboxes and radio buttons are/were in #2856459: Seven Style Guide: Checkboxes & Radio Buttons which is why I asked what should we be looking for here. Issue summary is definitely not up to date yet.
Comment #74
lauriiiUpdated the proposed resolution.
Comment #75
Gábor HojtsyComment #76
Gábor HojtsyThanks for the update and guidance on where to look. I removed the misleading prior screenshot from the summary. Verified the patch looks like what the issue summary says *now* :)
Comment #77
Gábor HojtsyComment #78
Gábor HojtsyCommitted 4e8c573 and pushed to 8.6.x. Thanks!
Comment #80
lauriii🚀🙌🎉