bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Disabled icons

Open svdgriendt opened this issue 13 years ago • 7 comments

For example when using <a href="#" class="icon-stop"></a> a stop icon is shown. But when such an option is visible, but not enabled, it is expected to only adding the disabled class and/or disabled="disabled"attribute to disable it:

<a href="#" class="icon-stop disabled"><a/>
<a href="#" class="icon-stop" disabled="disabled"`></a>
<a href="#" class="icon-stop disabled" disabled="disabled"></a>

Expected is the following:

  1. Visual difference between "enabled" and "disabled" icons
  2. Optional: when "disabled" and it is an action element (like a and button), then also alter the cursor

What I currently use (and note that this is not fully cross-browser):

[class^="icon-"][disabled], [class*=" icon-"][disabled], [class^="icon-"].disabled, [class*=" icon-"].disabled { cursor: default; opacity: 0.25; }

Isolated example where "disabled" icons look the same as "enabled" icons:

<div class="container">
  <span class="icon-play"></span>
  <span class="icon-pause" disabled="disabled"></span>
  <span class="icon-stop" disabled="disabled"></span>
</div>

An example of before and after: bootstrap-disabled-icons-example.png

svdgriendt avatar Dec 09 '12 18:12 svdgriendt

I think from 3.0 if the font icons is implement it could be an easy fix, but it would be a mess with the image files..

boh1996 avatar Dec 09 '12 23:12 boh1996

I totally agree that with font icons these kind of things would be much easier to do. I was not aware that this is a feature in the new version and if that is the case, it would be useless to find a solution for the halflings.

However, an other proper solution for the halflings is to provide a third set, next to the black and white, that represents the disabled state, like gray.

Is there any reference to the new featureset so I can embed it in here and close this right away?

svdgriendt avatar Dec 12 '12 13:12 svdgriendt

The font icons is mentioned in this wiki https://github.com/twitter/bootstrap/wiki/Upcoming-3.0-changes

boh1996 avatar Dec 12 '12 13:12 boh1996

I've checked those notes twice and the second time I indeed noticed that a move will be made to the fonts by Glyphicons. However, these are only included in the PRO package, so I'm not sure how this will go, as Bootstrap is offered without any fees.

On top of all this, a direct quote:

While our last major version bump (2.0) was a complete rewrite of the docs, CSS, and JavaScript, the move to 3.0 is not quite as ambitious. This is an ongoing document to identify the changes we'll be making along the way.

My conclusion is that this update will not be comming any time soon and therefore I suppose my request is still valid. I in fact do not care how the solution is made, let it be images, fonts or whatever, just that it's there. I cannot imagine that nobody else needed such a thing, especially for the action kind of icons...

svdgriendt avatar Dec 14 '12 23:12 svdgriendt

We're using font icons in 3.0—going to close this out. Not a feature we're going to provide in the core for now. Thanks though!

mdo avatar Dec 20 '12 08:12 mdo

Even though this is a closed issue, here is the CSS to make disabling the icons work in diabled menu items:

/* Workaround for issue where icons in disabled menu items don't turn "grey" to
 * indicate disabled state
 * https://github.com/twbs/bootstrap/issues/6187 */
.dropdown-menu > li.disabled > a > [class^="icon-"],
.dropdown-menu > li.disabled > a:hover > [class^="icon-"],
.dropdown-menu > li.disabled > a:focus > [class^="icon-"],
.dropdown-menu > li.disabled > a > [class*=" icon-"],
.dropdown-menu > li.disabled > a:hover > [class*=" icon-"],
.dropdown-menu > li.disabled > a:focus > [class*=" icon-"]
{
    cursor: default;
    opacity: 0.25;
    background-image: url("../img/glyphicons-halflings.png")
}

I don't expect any action from anybody, but here is the stuff. Can be modified to suit your particular use-case, I guess.

pmorch avatar Aug 01 '13 17:08 pmorch

Something that became possible recently is this: http://caniuse.com/#feat=css-filters

img.disabled
{
    opacity: 0.8;
    filter: grayscale( 100% );
    -webkit-filter: grayscale( 1 );
}

Not sure if it works on the font icons as well but it's a nice thing imo Wanted to leave this here after a search brought me here and got me in the right direction...

neico avatar Mar 02 '15 01:03 neico