(please do not commit - to be used (maybe) for a live commit at dev days)

Suggest commit message:
git commit -m 'Issue #2470137 by tadityar, zaporylie, pec, LewisNyman, ry5n, Bojhan, yoroy: Style Seven'\''s fieldset elements'

Problem/Motivation

Seven's fieldset elements are unstyled, see the screenshots in #1493324: Inline form errors for accessibility and UX

Proposed resolution

Implement the styling from the styleguide https://groups.drupal.org/node/283223#Fieldset

In #2002336: Introduce a CSS class to hide borders of fieldset elements we introduced a class called fieldgroup that unstyles fieldsets which means we can use fieldsets for accessibility without affecting the visuals.

Previously all fieldsets had margin styling even if they had the fieldgroup class applied.

This patch removes margin styling from fieldsets with the fieldgroup class in Seven. This does not cause any visual regressions because that the fieldsets with the class fieldgroup also had the class form-item which applies margin styling that overwrote the fieldgroup margins so they never applied.

Remaining tasks

Style fieldset elements
Download and install vijaycs85's Errorstyle module from https://github.com/vijaycs85/errorstyle and go to /error-style/form to test a fieldset
add before and after screenshots to the issue summary

User interface changes

Fieldsets look nicer!

API changes

None

Before:

After:

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because styleguide implementation
Issue priority Normal priority because it' an isolated incident, we don't use fieldset elements that often in core.
Unfrozen changes Unfrozen because it only changes CSS
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tadityar’s picture

Assigned: Unassigned » tadityar

Working on this

tadityar’s picture

Status: Active » Needs review
FileSize
947 bytes
33.82 KB

Initial attempt.

Somehow I can't get the "Source Sans Pro" font to work and thus still confused on how to get this one semibolded and from the screenshot 15px/24px is too small for the legend. Any suggestion on other size?

LewisNyman’s picture

Status: Needs review » Needs work

There are some differences between the original proposal and in implementation. It wasn't so simple to add the webfont to core. See: #1986082: Add a webfont version of Source Sans Pro font
Because we don't have the same font, we can't use the same font sizes as the proposal. I would try using 1em instead.

Also:

  1. +++ b/core/themes/seven/css/components/form.css
    @@ -6,7 +6,21 @@ form {
    +  padding-top: 30px;
    +  position: relative;
    +
    +}
    

    There is an empty line here that we need to remove

  2. +++ b/core/themes/seven/css/components/form.css
    @@ -85,12 +99,15 @@ label[for] {
     /* Filter */
    +.filter-wrapper {
    +  font-size: 0.923em;
    +}
    ...
    -  font-size: 0.95em;
    +  font-size: 0.9em;
     }
    

    Are these changes related to this issue?

tadityar’s picture

Status: Needs work » Needs review
FileSize
947 bytes
34.1 KB

Fixed #1, yes #2 is not related to this issue.. accidentally got there :)

New screenshot attached.

tadityar’s picture

err.. I edited the wrong file sorry

LewisNyman’s picture

Status: Needs review » Needs work

Looking good! Thanks.

  1. +++ b/core/themes/seven/css/components/form.css
    @@ -6,7 +6,20 @@ form {
     fieldset {
    

    We should replace this selector with fieldset:not(.fieldgroup) because we introduced this unstyled class in this issue #2408481: Rewrite help.module component's inline with our CSS standards

  2. +++ b/core/themes/seven/css/components/form.css
    @@ -6,7 +6,20 @@ form {
    +  font-family: 'Source Sans Pro','Lucida Grande', sans-serif;
    

    We should remove this font-family declaration

tadityar’s picture

Status: Needs work » Needs review
FileSize
646 bytes
586 bytes
LewisNyman’s picture

Status: Needs review » Needs work

Excellent! I had a look at this patch applied and I think the padding on the left and right need to be tweaked.

+++ b/core/themes/seven/css/components/form.css
@@ -5,8 +5,20 @@ form {
+  padding-top: 30px;

Instead can we use something like: padding: 30px 18px 18px;

After that we are 100% good.

LewisNyman’s picture

Assigned: tadityar » Unassigned
Issue tags: +Novice

Tagging novice because the remaining task is simple enough for someone to work on at Drupal Dev Days

pec’s picture

Hi, this is my first try at contributing to drupal for this drupaldevdays mentoring sprint.
I think this should be ok.

keyral’s picture

Status: Needs work » Needs review
LewisNyman’s picture

LewisNyman’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
FileSize
264.79 KB
264.79 KB

This looks good to me! Thanks

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/seven/css/components/form.css
@@ -5,8 +5,20 @@ form {
+fieldset:not(.fieldgroup) legend{

I think we need a space after legend

zaporylie’s picture

Assigned: Unassigned » zaporylie

Will fix it.

zaporylie’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
653 bytes

Bumping it back to RTBC.

LewisNyman’s picture

Status: Reviewed & tested by the community » Needs review

RTBC++

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Urgh sorry, back to RTBC

zaporylie’s picture

Assigned: zaporylie » Unassigned

yeah... I left it RTBC since change was so small.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/seven/css/components/form.css
@@ -5,8 +5,20 @@ form {
-fieldset {
+fieldset:not(.fieldgroup) {
...
   margin: 1em 0;

Doesn't this change the .fieldgroup margins. Was that intended?

LewisNyman’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
FileSize
816.69 KB
778.98 KB

Good catch. Funnily enough it doesn't. The margins never applied to fieldgroups because it was being overridden by form-item. I'm happy to have fieldgroup as a completely unstyled class, and let form-item handle spacing for consistency.

Before:

After:

YesCT’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update, +drupaldevdays

discussed at dev days

LewisNyman’s picture

Issue summary: View changes
FileSize
275.35 KB
LewisNyman’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

I've added a suggested commit message to the top of the issue summary that includes credit to the original designers of the Seven style guide:
git commit -m 'Issue #2470137 by tadityar, zaporylie, pec, LewisNyman, ry5n, Bojhan, yoroy: Style Seven'\''s fieldset elements'

alexpott’s picture

Assigned: Unassigned » alexpott
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed a1717dc and pushed to 8.0.x. Thanks!

  • alexpott committed a1717dc on 8.0.x
    Issue #2470137 by tadityar, zaporylie, pec, LewisNyman, ry5n, Bojhan,...

Status: Fixed » Closed (fixed)

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