Problem/Motivation

The CSS classes for disabled buttons were changed in #1986074: Buttons style update

-    $element['#attributes']['class'][] = 'form-button-disabled';
+    $element['#attributes']['class'][] = 'is-disabled';
...
-    $element['#attributes']['class'][] = 'image-button-disabled';
+    $element['#attributes']['class'][] = 'is-disabled';

...but the bartik CSS it's still using the old CSS classes.

Plus: We have dropped the IE 6/7/8 suport so we don't need anymore the -ms-filter in our CSS

Proposed resolution

We need to replace the old CSS classes in Bartik theme with 'is-disabled'

These styles should be located in buttons.css, not in form.css

Remaining tasks

None

User interface changes

None

API changes

None

Original report by @username

None

CommentFileSizeAuthor
#39 save-and-publish-disabled-hover.png29.03 KBalex-arriaga
#39 save-and-publish-disabled.png29.03 KBalex-arriaga
#39 save-and-publish-hover.png27.74 KBalex-arriaga
#39 save-and-publish.png28.77 KBalex-arriaga
#39 preview-disabled-hover.png28.06 KBalex-arriaga
#39 preview-disabled.png28.06 KBalex-arriaga
#39 preview-hover.png28.61 KBalex-arriaga
#39 preview.png28.77 KBalex-arriaga
#38 interdiff-29-32.txt409 bytesbetovarg
#33 save-and-publish-hover.jpg26.21 KBalex-arriaga
#33 save-and-publish.jpg23.57 KBalex-arriaga
#33 content-button-disabled-hover.jpg12.99 KBalex-arriaga
#33 content-button-disabled.jpg13.8 KBalex-arriaga
#33 content-button-hover.jpg13.26 KBalex-arriaga
#33 content-button.jpg12.7 KBalex-arriaga
#32 bartik-disabled-buttons-2400863-32.patch1.66 KBbetovarg
#30 disabled-button-gif.gif57.26 KBemma.maria
#30 Screen Shot 2015-01-26 at 16.35.00.png25.76 KBemma.maria
#29 buttons-to-buttons.css_.patch1.67 KBmacmladen
#27 Screen_Shot_2015-01-20_at_22_38_12.png29.27 KBemma.maria
#27 button_hover.gif26.43 KBemma.maria
#27 image_button_hover.gif6.95 KBemma.maria
#26 buttons-to-buttons.css_.patch1.56 KBmacmladen
#24 buttons-to-buttons.css_.patch1.42 KBmacmladen
#22 buttons-to-buttons.css_.patch1.5 KBmacmladen
#19 buttons-to-buttons.css_.patch1.56 KBmacmladen
#17 buttons-to-buttons.css_.patch1.53 KBmacmladen
#12 buttons-after.png1.63 KBidebr
#12 buttons-before.png2.18 KBidebr
#12 input-disabled.gif9.33 KBidebr
#8 disabled-buttons-bartik.patch1.01 KBoriol_e9g
#7 no-image-button.patch716 bytesoriol_e9g
#3 no-ms-filter-2400863-3.patch512 bytesoriol_e9g
no-ms-filter.patch488 bytesoriol_e9g

Comments

oriol_e9g’s picture

Title: Remove ms-filter » Remove ms-filter from CSS
oriol_e9g’s picture

Title: Remove ms-filter from CSS » Remove CSS ms-filter
oriol_e9g’s picture

StatusFileSize
new512 bytes

Sorry, If we are strict we can also remove "filter", IE9 supports opacity.

http://caniuse.com/#search=opacity

oriol_e9g’s picture

Title: Remove CSS ms-filter » Remove ms-filter and filter CSS property
nod_’s picture

Issue tags: -RSS, -drop ie8 +CSS, +ie8

"ie8" is an actual tag to help out IE8 module :)

idebr’s picture

Component: CSS » Bartik theme

@oriol_e9g I was trying to test this issue, but I was unable to find any references to this class. It appears the css class should have been converted to 'image-button.is-disabled' earlier in issue #1986074: Buttons style update, but it never was.

oriol_e9g’s picture

Category: Task » Bug report
StatusFileSize
new716 bytes

You are correct, actually this style is never used.

We have changed the CSS class in #1986074: Buttons style update(https://www.drupal.org/files/issues/seven_buttons_1986074_109.patch)

-    $element['#attributes']['class'][] = 'image-button-disabled';
+    $element['#attributes']['class'][] = 'is-disabled';

We can remove the filter and fix the bug.

oriol_e9g’s picture

Title: Remove ms-filter and filter CSS property » Correct styles for disabled buttons
StatusFileSize
new1.01 KB

Oh! I have found the same problem with dissabled buttons, new patch.

oriol_e9g’s picture

Issue summary: View changes
emma.maria’s picture

Oh the issue for this existed already here #1282982: Clean up CSS for buttons in Bartik, but as this one is defined so nicely and has patches to review I will close the other one.

lewisnyman’s picture

Issue tags: +Needs manual testing

The code looks good, is there a page or use case we can use to make sure this works?

idebr’s picture

Status: Needs review » Needs work
StatusFileSize
new9.33 KB
new2.18 KB
new1.63 KB

@LewisNyman The only 'image-button' currently in core is the cogwheel on the Field UI. I am not aware of any way to make this button disabled.

@oriol_e9g The classes apply correctly, but the styling suggests there is still an action available. See this screen capture for illustration:

Can you reset the cursor and background-color to its default for disabled buttons? For an example see seven/components/buttons.theme.css:

.button:disabled,
.button:disabled:active,
.button.is-disabled,
.button.is-disabled:active {
  border-color: #d4d4d4;
  background: #ededed;
  box-shadow: none;
  color: #5c5c5c;
  font-weight: normal;
  cursor: default;
  text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
}

Obligatory screenshots:

Buttons before:

Buttons after:

lewisnyman’s picture

Ah yes, that will do. These styles should be located in buttons.css, not in form.css

macmladen’s picture

Assigned: Unassigned » macmladen
macmladen’s picture

I will try to resolve this issue by checking what is the current state of this issue in current repository of Drupal 8.0.x for the Drupal global Sprint Weekend 17.01.2015.

First, by searching though whole Drupal 8.x project, it seems that initial post still holds,

  1. The only place in whole Drupal project where is mentioned class form-button-disabled is in Bartik, so it is not referenced anyhere (except if, maybe somehow constructed in code somewhere) — therefore, I can pretty safely assume that CSS may be changed to accommodate new class is-disabled
  2. Although semantically, is-disabled does look more like active test than as state, there is disabled class in theme seven but not anywhere else and it is used in parallel with is-disabled in theme seven just to be safe — this could maybe be adopted in
  3. The class is-disabled appears in following files so it would not be much of a hassle to standardize on disabled which makes more sense to me (but that is the case for reopening #1986074: Buttons style update:
    1. core/lib/Drupal/Core/Render/Element/Button.php
    2. core/lib/Drupal/Core/Render/Element/ImageButton.php
    3. core/modules/system/src/Tests/Form/FormTest.php
idebr’s picture

macmladen’s picture

Assigned: macmladen » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.53 KB

I've checked things and done what LewisNyman suggested, moved buttons from form.css to buttons.css so it seems to me it can be tested and committed.

idebr’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -23,3 +23,20 @@
    +.button.is-disabled,
    +.button.is-disabled:hover,
    +.button.is-disabled:active,
    +.button.is-disabled:focus
    + {
    

    The curly bracket can go on the line with the last selector: .button.is-disabled: focus {

  2. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -23,3 +23,20 @@
    +.image-button.is-disabled,
    +.image-button.is-disabled:hover,
    +.image-button.is-disabled:active,
    +.image-button.is-disabled:focus {
    +  opacity: .5;
    +  cursor: default;
    +}
    

    The last 3 selectors are superfluous as they don't override any existing properties

  3. Could you also reset the background on disabled image buttons as I mentioned in #8?
macmladen’s picture

StatusFileSize
new1.56 KB

You are right, also in form.css there was curly bracket left on next line, both corrected, added background (if I understood well?)

macmladen’s picture

Status: Needs work » Needs review
idebr’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -23,3 +23,20 @@
    +.image-button.is-disabled:hover,
    +.image-button.is-disabled:active,
    +.image-button.is-disabled:focus {
    

    These selectors can still be removed :)

  2. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -23,3 +23,20 @@
    +  background: #ededed;
    

    Sorry, I was being unclear. By background reset I mean the item should have no background, eg. background: none.

  3. +++ b/core/themes/bartik/css/components/form.css
    @@ -138,23 +138,11 @@ input.form-submit:focus {
    +  cursor: default;
    

    The cursor property is no longer necessary, since the remaining selectors have no css property for cursor.

macmladen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB

I'm a bit harder to follow but I'll assume I got it right this time :)

lewisnyman’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -21,5 +21,19 @@
     .button:focus {
       text-decoration: none;
       color: #5a5a5a;
    -  background: #dedede;
    +  background: none;
    

    We are affecting all buttons here, I don't think this is an intentional change

  2. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -21,5 +21,19 @@
    +.button.is-disabled,
    +.button.is-disabled:hover,
    +.button.is-disabled:active,
    +.button.is-disabled:focus {
    

    Idebr mentioned before that these could be removed

  3. +++ b/core/themes/bartik/css/components/buttons.css
    @@ -21,5 +21,19 @@
    +  opacity: .5;
    

    I think we always add a 0 to the beginning of these decimal points

macmladen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB

With #3 I agree completely, I've missed that out.

As for #2, Idebr didn't say about that specifically but seems logical to remove if the same for image button was removed.

But for #1 I am not so sure. It is affecting but whole selector is affecting and it does make sense as it signifies the change of the state so it should be left there. IF you look at the previous selector in the file .buton it is very logical that next one (the one you argue in #1) is dealing with states.

Can you be more specific with some example why this shouldn't be?

idebr’s picture

Status: Needs review » Needs work
+++ b/core/themes/bartik/css/components/buttons.css
@@ -21,5 +21,16 @@
-  background: #dedede;
+  background: none;
+}
...
+.image-button.is-disabled {
+  background: #ededed;

It appears I was very unclear, terribly sorry about that :(

The background: none should applied to image-button.is-disabled to prevent the background-color from appearing on disabled image-buttons (see the behavior in #8 for reference)

macmladen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.56 KB

OK, dear friends I hope this one will fix everything and satisfy everyone :)

First, background: none doesn't clear the assigned color so we need transparent to override assigned colors.

On the other hand I haven't seen how could I make cog or button appear as disabled so I fabricated in browser to simulate and check behavior.

I hope I understood what you all said and made the right patch. This should be fixed and we should move on to more important tasks so let us all make an effort and conclude this ASAP so please be constructive as much as possible with comments and lets close this once,

emma.maria’s picture

StatusFileSize
new6.95 KB
new26.43 KB
new29.27 KB

I tested the current patch and noticed the following things.

  1. Looking at disabled image-buttons they work great now...
  2.  

  3. We now need to also add back the disabled hover styles for regular disabled buttons, which were lost when the form-button-disabled selector's styles. Currently disabled buttons with the class .is-disabled have a hover state. See below...

     
  4.  

  5. Also one code error in the patch...
    +++ b/core/themes/bartik/css/components/buttons.css
    @@ -21,5 +21,21 @@
    +.image-button.is-disabled:hover,
    +.image-button.is-disabled:active,
    +.image-button.is-disabled:focus {
    +  background: transparent;;
    

    There is a double ;; after transparent.

emma.maria’s picture

Status: Needs review » Needs work
macmladen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.67 KB

I've rechecked and bit optimized CSS here with disabled buttons.

Please: how do you make those animated screen capture?

emma.maria’s picture

Status: Needs review » Needs work
StatusFileSize
new25.76 KB
new57.26 KB
+++ b/core/themes/bartik/css/components/buttons.css
@@ -19,7 +19,24 @@
 .button:hover,
 .button:active,
 .button:focus {
-  text-decoration: none;
+  background: transparent;
   color: #5a5a5a;
-  background: #dedede;
+  text-decoration: none;
+}

Why did you change these styles? Can you put this back as normal 'a' element links that have the class button need these styles on hover etc.
See this example on the admin/content page....

 
Otherwise the disabled button styles now work great, see latest gif below...
 

betovarg’s picture

Assigned: Unassigned » betovarg
betovarg’s picture

Assigned: betovarg » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.66 KB

Fixed background color for hover, active and focus states for buttons, as said on comment #30.

alex-arriaga’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing
StatusFileSize
new12.7 KB
new13.26 KB
new13.8 KB
new12.99 KB
new23.57 KB
new26.21 KB

Testing "+Add content button

1) I visited /admin/content to test the new CSS class.
2) I simulated the disabled state of the button adding the class using Chrome Dev Tools. Please, see next code:

<a href="/node/add" class="button button-action is-disabled" data-drupal-link-system-path="node/add">Add content</a>

3) Following images are tests I did.

Add content enabled

Add content enabled / hover

Add content disabled

Add content disabled / hover

Testing "Save and Publish" button

1) I went to this path to review the new "is-disabled" class: /node/add/article
2) In the Chrome Dev Tools I added the CSS class to simulate the expected behaviour. Please, see following line:

<input type="submit" name="op" value="Save and publish" class="button form-submit is-disabled">

3) Following images show the manual tests I did.

Save and publish enabled

Save and publish hover

mherchel’s picture

Title: Correct styles for disabled buttons » Add the correct classes and styles for disabled buttons in Bartik
yesct’s picture

looks like need the disabled screenshot also (for the preview example)

idebr’s picture

Beautiful! +1

jclema’s picture

Issue summary: View changes
betovarg’s picture

StatusFileSize
new409 bytes

Here is an interdiff between the patches on #29 and #32.

alex-arriaga’s picture

Issue summary: View changes
StatusFileSize
new28.77 KB
new28.61 KB
new28.06 KB
new28.06 KB
new28.77 KB
new27.74 KB
new29.03 KB
new29.03 KB

Testing "+Add content" button

1) I visited /admin/content to test the new CSS class.
2) I simulated the disabled state of the button adding the class using Chrome Dev Tools. Please, see next code:

<a href="/node/add" class="button button-action is-disabled" data-drupal-link-system-path="node/add">Add content</a>

3) Following images are tests I did.

Add content enabled

Add content enabled / hover

Add content disabled

Add content disabled / hover

Testing "Save and Publish" button

1) I went to this path to review the new "is-disabled" class: /node/add/article
2) In the Chrome Dev Tools I added the CSS class to simulate the expected behaviour. Please, see following line:

<input type="submit" name="op" value="Save and publish" class="button form-submit is-disabled">

3) Following images show the manual tests I did.

Save and publish enabled

Only local images are allowed.

Save and publish enabled / hover

Only local images are allowed.

Save and publish disabled

Only local images are allowed.

Save and publish disabled / hover

Only local images are allowed.

Testing "Preview" button

1) I went to this path to review the new "is-disabled" class: /node/add/article
2) In the Chrome Dev Tools I added the CSS class to simulate the expected behaviour. Please, see following line:

<input type="submit" id="edit-preview" name="op" value="Preview" class="button form-submit is-disabled">

3) Following images show the manual tests I did.

Preview enabled

Preview enabled / hover

Only local images are allowed.

Preview disabled

Only local images are allowed.

Preview disabled / hover

Only local images are allowed.

yesct’s picture

I'm not clear on why this is a bug.
If it is a task, a beta evaluation would be super.
https://www.drupal.org/core/beta-changes

emma.maria’s picture

Category: Bug report » Task

I have looked at the screenshots in #27 and #39 and compared them with head. None of the elements affected by this work are visually different between head and the patch in #32. The code for this work is all CSS code which has been placed in the correct files and meet coding standards. Buttons are functioning correctly when disabled. Plus we checked other states that may have been affected by this work, this is shown in the screenshots in #39. RTBC++

emma.maria’s picture

  • Dries committed 7190ad8 on 8.0.x
    Issue #2400863 by alex-arriaga, MacMladen, emma.maria, oriol_e9g, idebr...
dries’s picture

Status: Reviewed & tested by the community » Fixed

Thank you! Committed at the code sprint in Bogota.

emma.maria’s picture

Issue tags: +LatinAmerica2015

Status: Fixed » Closed (fixed)

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