Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom select box styling #127

Merged
merged 20 commits into from
Jun 24, 2015
Merged

Custom select box styling #127

merged 20 commits into from
Jun 24, 2015

Conversation

aaronshekey
Copy link

A stab at custom styling for our select dropdowns. They've always looked a little out of place on pages like this...

Context before

context

Context after

screen shot 2015-06-09 at 2 42 52 pm

Safari 8.0.6

screen shot 2015-06-09 at 2 31 41 pm
screen shot 2015-06-09 at 2 31 47 pm

Retina

screen shot 2015-06-09 at 2 39 38 pm

IE11 Windows 7

dropdown
dropdown2

cc: @mdo @jonrohan

}

&::-ms-expand {
opacity:0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colon after property should be followed by one space

padding: 7px 24px 7px 8px;
vertical-align: middle;
background-color: #fff;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAaCAMAAACNQ/wIAAAAYFBMVEUzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMS2aZBAAAAH3RSTlMAAQYNDg8VJDQ2N0JbdXZ4h4mKpL3Iycvb6vDx8vn+GLdSCAAAAHBJREFUeNq90TcSgDAMRFGRMwZMTnv/W+IBm6BxzSt/pUBGURKT73v+LdkGbNm7xDOUOXlKNOE0RaaEI7QxvIrX4db5pLgtXlqXyJH4kA5VYCr6Xw2msYxqWUgJetyGwH4cfkIjXaCsqfUd/GmMEKQdADIVzQIQilIAAAAASUVORK5CYII=) no-repeat right 8px center;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't typically base64 images, but not saying it's a bad thing. Just asking the obvious if we're cool with this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine doing this as a static asset someplace, but would need advice as to how we set that up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it as base64 since Primer itself has no CDN.

@jonrohan
Copy link
Member

jonrohan commented Jun 9, 2015

Overall I'm 👍 on this kind of improvement. I personally would like it to look slightly closer to our buttons than our text boxes, just to give it a little more dropdownish feel. And to indicate that it's clickable.

@jonrohan
Copy link
Member

jonrohan commented Jun 9, 2015

screen shot 2015-06-09 at 4 48 35 pm

An afterthought, if we go down this road, should we make our other custom dropdowns match? Or at least use the double arrow icon?

@aaronshekey
Copy link
Author

I'm fine with there being a difference between true select boxes having the double arrow and the drop downs having the single. The former is a true form element where the latter is just a navigation item. I can add a stronger gradient to match the buttons, but I'll defer to @mdo on the direction we want to go with that. I like that these are currently the inverse of an input.

@mdo
Copy link
Contributor

mdo commented Jun 9, 2015

I'm actually kind of okay with making it look a bit different than our buttons and custom .select-menu component. The behavior is a lot different between those two elements, so conflating the two could be harmful from a UX side.

Originally I wasn't into the bottom-up shadow, but it feels push-y enough and looks pretty good still. I think the arrow needs to be a little more to the left, but that's about it.

Lastly, we might want to add some basic styles to ensure proper vertical alignment of non-styled <select>s. For example, we're changing the height there—should we do that for all <select>s? Bootstrap does this, which triggers the fallback styles for Webkit browsers, but it's a consistent height and alignment which is more helpful I think.

@aaronshekey
Copy link
Author

I've now added fallback styling to the select element, which basically means I've moved most of the visual styling to the element itself save for the arrow overrides.

Safari

screen shot 2015-06-09 at 5 18 41 pm

Chrome

screen shot 2015-06-09 at 5 20 56 pm

Should be rad. Selects also take the same styling as their input counterparts in Form Groups
screen shot 2015-06-09 at 5 19 45 pm

@mdo mdo added this to the v2.3.0 milestone Jun 10, 2015
background-size: 9px 13px;
box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.075);
// Have to include vendor prefixes as the `appearance` property isn't part of the CSS spec.
-webkit-appearance: none;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid vendor prefixes.

@mdo
Copy link
Contributor

mdo commented Jun 10, 2015

Pushed a bunch of changes clean up a few things:

  • Broke apart the default and custom selects to better explain what each does.
  • Updated the default <select> styles to target any element that doesn't have [multiple].
  • Renamed .select-small to .select-sm to match our buttons.
  • Fixed the broken form group styles example.
  • Excluded the forms file from SCSS lint to avoid those vendor prefix warnings.

Here are some updated screenshots showing the latest:

screen shot 2015-06-10 at 12 36 42 pm
screen shot 2015-06-10 at 12 36 51 pm
screen shot 2015-06-10 at 12 36 59 pm
screen shot 2015-06-10 at 12 37 07 pm

box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.075);
// scss-lint:disable VendorPrefix
// Have to include vendor prefixes as the `appearance` property isn't part of the CSS spec.
-webkit-appearance: none;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid vendor prefixes.

@jonrohan
Copy link
Member

image

no idea what is wrong with houndci

@aaronshekey
Copy link
Author

Loving where this is at. @mdo, Thanks for jumping in and fixing the last bits.

Sidenote: Maybe we should consider switching to postcss https://github.com/nDmitry/grunt-postcss instead of the deprecated thing we've got going on now.

@mdo
Copy link
Contributor

mdo commented Jun 11, 2015

Sidenote: Maybe we should consider switching to postcss https://github.com/nDmitry/grunt-postcss instead of the deprecated thing we've got going on now.

What's deprecated?

@aaronshekey
Copy link
Author

Is this what we're using? https://github.com/nDmitry/grunt-autoprefixer It's been deprecated in favor of grunt-postcss.

@mdo
Copy link
Contributor

mdo commented Jun 12, 2015

Oh, yeah, we can do that for this release.

@mdo mdo mentioned this pull request Jun 12, 2015
mdo added a commit that referenced this pull request Jun 24, 2015
@mdo mdo merged commit bedf2e4 into master Jun 24, 2015
@mdo mdo deleted the select-boxes branch June 24, 2015 18:58
timv88 pushed a commit to timv88/primer that referenced this pull request Aug 12, 2015
Add Windows emoji fonts to font fallback list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants