Problem/Motivation

See: #1995272: [Meta] Refactor module CSS files inline with our CSS standards

Proposed resolution

Review the CSS against our standards, see:
http://drupal.org/node/1887918#best-practices
https://www.drupal.org/node/2408617
#1190252: [573] Use csslint as a weapon to beat the crappy CSS out of Drupal core

Remaining tasks

Review current CSS
Write a patch to fix the suggestions
Run CSSlint against the new CSS
Test for regressions:
You have to enable the core-language modules, add a language, and then go to admin/config/regional/config-translation where you should scroll until you find a translate-button, then click 'add' next to the language you added, it is the following page where the css is being used....

User interface changes

None

API changes

None

Comments

mathieuspil’s picture

Status: Active » Needs review
StatusFileSize
new2.24 KB

For reviewing purposes: You have to enable the core-language modules, add a language, and then go to admin/config/regional/config-translation where you should scroll until you find a translate-button, then click 'add' next to the language you added, it is the following page where the css is being used....

Done so far:
- Removed the use of the !important declaration without breaking anything. => fixes the only CSSlint-errors.
- Removed the layout styling and replaced it with the layout-classes.

The only styling left in the css file is to hide the double label on the right side on mobile screens. when the left side and the right side are beneath each other.
For me the label can always be visually hidden (on small and on large screens.) => This way the css file can be deleted entirely. and there should be visually-hidden-class on the label to the right.

But feedback on any of these points is highly appreciated as always!

lewisnyman’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new502.41 KB

Nice!

The only styling left in the css file is to hide the double label on the right side on mobile screens. when the left side and the right side are beneath each other.

Ah yeah you're right. I'm not sure of the beneits of hiding it at all but let's leave it for now and assume it was an intentional design decision we would have to discuss. Maybe we could open issues to add something like .mobile-hidden reusable classes.

+++ b/core/modules/config_translation/css/config_translation.admin.css
@@ -7,8 +7,8 @@
+.config-translation-form .translation-set label {

Can we simplify this selector and use a class like translation-set-label?

.config-translation-form .translation-set label {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  overflow: hidden;
  height: 1px;
  width: 1px;
}

If we set a max-width media query on this CSS, then we can remove the min-width CSS that undoes it.

saki007ster’s picture

Assigned: Unassigned » saki007ster
saki007ster’s picture

Simplyfied the selector .config-translation-form .translation-set label to .translation-set label and set the max-width media query removing the reseting media query.

saki007ster’s picture

Status: Needs work » Needs review
saki007ster’s picture

Assigned: saki007ster » Unassigned
lewisnyman’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new446.5 KB

Great thanks! Here is a screenshot of the form to show the label is still hidden.

There are no more CSSlint errors in this file.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs screenshots, +Needs manual testing

This patch is now hiding both labels at widths of less than 850px breaking the form. The point is to hide the second label when the display is only in one column.

lewisnyman’s picture

Issue summary: View changes
StatusFileSize
new369.35 KB

Ahh got it, thanks Alex. This is how it looked before

manjit.singh’s picture

@lewis I think this patch might be solved what alex has mentioned in #8. Please verify

manjit.singh’s picture

Status: Needs work » Needs review
lewisnyman’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots, -Needs manual testing
StatusFileSize
new208.61 KB
new151.86 KB

Nice one! Thanks. Here are the screenshots

manjit.singh’s picture

Thanks , this looks good to me :)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/config_translation/css/config_translation.admin.css
@@ -7,38 +7,12 @@
+@media screen and (max-width: 38em) {

So the half layout column is defined in the media query

@media screen and (min-width: 38em) {

Does this mean at exactly 38em there will be two columns only one will have the labels? Yep manual testing reveals that it is possible.

manjit.singh’s picture

Yup @lewis I think Alex is talking about this issue ;)

translation-609px.png

translation-608px.png

adding patch of media query based on px :)

screenshots After applying #15 patch

after-applying-patch-translation-607px.png

after-applying-patch-translation-608px.png

after-applying-patch-translation-609px.png

@lewis Please verify.

mathieuspil’s picture

Status: Needs work » Needs review

Needs review for testing the latest patch

mathieuspil’s picture

Assigned: Unassigned » mathieuspil
Status: Needs review » Needs work
StatusFileSize
new590 bytes

Uploading an interdiff for clarity's sake.

I am not agreeing on the latest change of patch #15.

We shouldn't be using a different breakpoint for only this page.
Instead we should be using min-widths inside the media query in combination with the visually-hidden-class

Looking into this.

manjit.singh’s picture

Sure @MathieuSpil, Actually i was bit confuse while using this media query.

mathieuspil’s picture

Assigned: mathieuspil » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.38 KB
new791 bytes

Ok so after some thought, I was looking into applying the visually-hidden class on the second label. On devices wider than 38em we could then overwrite the visually-hidden-css so the label would then be visible again.

But when we consider the following:
- There are no classes that reset the visually-hidden class only on certain breakpoints in core (? I think ?)
- The second label is only for screenreaders and is only needed for when the columns are next to eachother.

So now we apply the visually-hidden-styling on the element (without using the class)
and starting from a min-width of 38em (as when the 2 column-layout kicks in) we can now easily reset the visually-hidden styling with the following:

@media screen and (min-width: 38em) {
  .translation-set__translated label {
    position: initial;
    width: auto;
    height: auto;
  }
}

This patch is based upon #10. because #15 was going in the wrong direction I think.

Status: Needs review » Needs work

The last submitted patch, 19: clean-up-config-translation-2485397-19.patch, failed testing.

mathieuspil’s picture

Status: Needs work » Needs review

Not sure why the test is failing, so rerolling

lewisnyman’s picture

Status: Needs review » Needs work
StatusFileSize
new126.46 KB

Thanks, I manually tested the patch and the behaviour is now expected as Alex raised:

I only found one problem from csslint - 20 5 Expected (static | relative | absolute | fixed | inherit) but found 'initial'.
I guess initial isn't valid but we could just use static or inherit?

gsharm’s picture

Assigned: Unassigned » gsharm
gsharm’s picture

Assigned: gsharm » Unassigned
Status: Needs work » Needs review
Issue tags: +SrijanSprintNight
StatusFileSize
new2.38 KB

Changes as suggested in #23 by Lewis.

manjit.singh’s picture

Status: Needs review » Reviewed & tested by the community

changes as suggested by lewis are done, so Setting it to RTBC :)

RavindraSingh’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/config_translation/css/config_translation.admin.css
    @@ -7,38 +7,18 @@
    +  position: absolute;
    

    CSS standard for adding attributes needs to be added.

  2. +++ b/core/modules/config_translation/css/config_translation.admin.css
    @@ -7,38 +7,18 @@
    +    height: auto;
    

    CSS standard for adding attributes needs to be added.

Overall, patch looks good to me but there are minor issues which Needs works.

gsharm’s picture

Assigned: Unassigned » gsharm
StatusFileSize
new2.39 KB

changes and ordering for CSS standards

gsharm’s picture

Assigned: gsharm » Unassigned
Status: Needs work » Needs review
RavindraSingh’s picture

Status: Needs review » Reviewed & tested by the community

Now it looks good.
Moving again this to RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 921db1f and pushed to 8.0.x. Thanks!

CSS is not frozen during beta.

  • alexpott committed 921db1f on 8.0.x
    Issue #2485397 by Manjit.Singh, MathieuSpil, gajendra sharma,...

Status: Fixed » Closed (fixed)

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