Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox 30 is not hiding select box arrows anymore

Tags:

html

css

firefox

I have always used the "trick":

select {
    -moz-appearance: none;
    text-indent: 0.01px;
    text-overflow: '';
}

to do custom select boxes on FF but since version 30 is released this stopped working completely. I have tried to find if this was deprecated but couldn't find anything. Is there a workaround, or another method to replace this?

like image 457
Jaypee Avatar asked May 28 '14 20:05

Jaypee


3 Answers

Update

As of January 2015, this now works again with the release of Firefox 35. See the answer below for historical reference.

 




 

Background

The hack that was used is this:

select {
    -moz-appearance: none;
    text-indent: 0.01px;
    text-overflow: '';
}

In my testing, on FF 29, -moz-appearance:none; had no affect. What caused the arrow box to not appear was the second two lines. It said that any overflow is to be replaced by an empty string, and then it used text-indent to cause the select to overflow. Since the arrow box is rendered as a single element, similar to a single letter, this caused it to be replaced by the empty string.

What Happened

Someone at Mozilla noticed that if you have padding on a dropdown select, the arrow doesn't change size. According to the bug report, this issue has now been fixed:

enter image description here

The problem is that this has divorced the arrow from normal CSS rules. I've tried padding, text-indent, margin, white-space, text-wrap, and a few more, and I can't find anything that will affect it. Elsewhere around the internet, people are saying the same thing, unfortunately.

What Now

  1. We have a few options. You can use an overlay combined with pointer-events:none to style the dropdown however you want: Tutorial

  2. You can create a completely separate dropdown to replace select, using Javascript: Tutorial

We can also watch the request on Firefox's Bugzilla, and hope that someday they will create a non-hacky way to do this. PLEASE NOTE: Don't go there and start posting comments about wanting it. Part of the reason it's been so delayed is that people threw a fit. It may help to vote for the issue.


Update Sept. 2014

This is now being actively worked on for Firefox. 2 patches have been submitted and have been awaiting review for a week. Most probably scenario is that this makes it into FF35 Aurora, and we have a few weeks for it to get reviewed and approved before the cutoff date (Firefox operates on a 6 week release schedule). It could also be delayed, and it could even theoretically be "uplifted", meaning patched in the current Aurora and Beta versions, to get released sooner.


Update Oct. 2014

This how now been officially resolved! Kind of. A patch to allow users to hide the dropdown arrow element has been committed and will be shipped with Firefox 35 in January 2015.

This will only allow users to hide the arrow. To style it is another issue, which has been spun off into another bug ticket which will be considered in the future.


Update Jan. 2015

This has now been fixed! Firefox 35 came out on January 13, and you can now use -moz-appearance:none to remove the arrow.

like image 99
Andy Mercer Avatar answered Nov 01 '22 12:11

Andy Mercer


Yes ! Is good ! Thks

JS FIDDLE

.customSelect {
    font-size: inherit;
    margin: 0;
    padding: 0.5em;
    background-color: transparent;
    color: #393939;
    opacity:1;
    -moz-appearance: none;
    border: 0 none;
    border-radius: 0px;
    border:1px solid #B1B2B3;
    padding-right: 2.5em;
}
like image 38
user3730166 Avatar answered Nov 01 '22 13:11

user3730166


.SelectBox select {
   background: transparent;
   width: 182px;
   padding-right: 29px;
   font-size: 100%;
   text-indent: 0.01px;
   text-overflow: "";
   border: none;
   height: 17.5px;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.SelectBox {
   width: 154px;
   height: 15.8px;
   overflow: hidden;
   background: url("Images/Arrow.png") no-repeat 141px center #ffffff;
   border-radius:2px;
   border: 1px solid #B90F22;
}

<div class="SelectBox">
   <select>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
   </select>
</div>

This seems to work fine in every major browser but IE. IE is falling back to the default dropdown so that shouldn't be too much of a problem.

like image 1
Tim Jongerius Avatar answered Nov 01 '22 14:11

Tim Jongerius