Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add [hidden] selector counteract all display declarations
Anytime a `display` declaration is used in Pure with a value other than
`none`, we need to add an additional rule with similar selectors
(appended with `[hidden]`) with a `display: none;` declaration. This
allows the `hidden` HTML attribute to work properly on elements styled
by Pure.

The following button will be hidden from view with these changes:

    <button class="pure-button" hidden>No showy</button>

Fixes #177
  • Loading branch information
ericf committed Nov 27, 2013
commit 2893e561e7fb7f50d379206da7b5e6cf33cf2b2e
3 changes: 2 additions & 1 deletion .csslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"box-sizing" : false,
"display-property-grouping": false,
"star-property-hack" : false
"star-property-hack" : false,
"unqualified-attributes" : false
}
4 changes: 4 additions & 0 deletions src/buttons/css/buttons-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
padding: 0;
border: 0;
}

.pure-button[hidden] {
display: none;
}
8 changes: 1 addition & 7 deletions src/buttons/css/buttons.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*csslint unqualified-attributes:false, outline-none:false*/
/*csslint outline-none:false*/

.pure-button {
font-family: inherit;
Expand Down Expand Up @@ -60,12 +60,6 @@
display: none;
}

/* Firefox: Get rid of the inner focus border */
.pure-button::-moz-focus-inner{
padding: 0;
border: 0;
}

.pure-button-primary,
.pure-button-selected,
a.pure-button-primary,
Expand Down
12 changes: 12 additions & 0 deletions src/forms/css/forms-r.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
margin-bottom: 0.3em;
display: block;
}
.pure-form input[hidden],
.pure-form label[hidden] {
display: none;
}

.pure-group input[type="text"],
.pure-group input[type="password"],
Expand All @@ -45,6 +49,9 @@
display: block;
width: 100%;
}
.pure-form-aligned .pure-control-group label[hidden] {
display: none;
}

.pure-form-aligned .pure-controls {
margin: 1.5em 0 0 0;
Expand All @@ -59,4 +66,9 @@
/* Increased bottom padding to make it group with its related input element. */
padding: 0.2em 0 0.8em;
}
.pure-form .pure-help-inline[hidden],
.pure-form-message-inline[hidden],
.pure-form-message[hidden] {
display: none;
}
}
45 changes: 45 additions & 0 deletions src/forms/css/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
box-sizing: border-box;
}

.pure-form input[hidden],
.pure-form select[hidden],
.pure-form textarea[hidden] {
display: none;
}

.pure-form input[type="text"]:focus,
.pure-form input[type="password"]:focus,
.pure-form input[type="email"]:focus,
Expand Down Expand Up @@ -57,11 +63,18 @@
outline: thin dotted #333;
outline: 1px auto #129FEA;
}

.pure-form .pure-checkbox,
.pure-form .pure-radio {
margin: 0.5em 0;
display: block;
}

.pure-form .pure-checkbox[hidden],
.pure-form .pure-radio[hidden] {
display: none;
}

.pure-form input[type="text"][disabled],
.pure-form input[type="password"][disabled],
.pure-form input[type="email"][disabled],
Expand Down Expand Up @@ -131,6 +144,9 @@
color: #333;
border-bottom: 1px solid #e5e5e5;
}
.pure-form legend[hidden] {
display: none;
}

.pure-form-stacked input[type="text"],
.pure-form-stacked input[type="password"],
Expand All @@ -153,6 +169,13 @@
margin: 0.25em 0;
}

.pure-form-stacked input[hidden],
.pure-form-stacked select[hidden],
.pure-form-stacked label[hidden],
.pure-form-stacked textarea[hidden] {
display: none;
}

.pure-form-aligned input,
.pure-form-aligned textarea,
.pure-form-aligned select,
Expand All @@ -164,6 +187,15 @@
*zoom: 1;
vertical-align: middle;
}
.pure-form-aligned input[hidden],
.pure-form-aligned textarea[hidden],
.pure-form-aligned select[hidden],
/* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */
.pure-form-aligned .pure-help-inline[hidden],
.pure-form-message-inline[hidden] {
display: none;
}

.pure-form-aligned textarea {
vertical-align: top;
}
Expand All @@ -179,6 +211,9 @@
width: 10em;
margin: 0 1em 0 0;
}
.pure-form-aligned .pure-control-group label[hidden] {
display: none;
}
.pure-form-aligned .pure-controls {
margin: 1.5em 0 0 10em;
}
Expand All @@ -202,6 +237,9 @@
position: relative;
top: -1px;
}
.pure-form .pure-group input[hidden] {
display: none;
}
.pure-form .pure-group input:focus {
z-index: 2;
}
Expand Down Expand Up @@ -243,10 +281,17 @@
vertical-align: middle;
font-size: 90%;
}
.pure-form .pure-help-inline[hidden],
.pure-form-message-inline[hidden] {
display: none;
}

/* Block help for forms */
.pure-form-message {
display: block;
color: #666;
font-size: 90%;
}
.pure-form-message[hidden] {
display: none;
}
8 changes: 8 additions & 0 deletions src/grids/css/grids-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
word-spacing: -0.43em;
}

.pure-g[hidden] {
display: none;
}

.pure-u {
display: inline-block;
*display: inline; /* IE < 8: fake inline-block */
Expand All @@ -65,3 +69,7 @@ this the same font stack that Normalize.css sets for the `body`.
.pure-g [class *= "pure-u"] {
font-family: sans-serif;
}

.pure-g [class *= "pure-u"][hidden] {
display: none;
}
4 changes: 4 additions & 0 deletions src/grids/css/grids-r.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
word-spacing: -0.43em;
}

.pure-g-r[hidden] {
display: none;
}

/*
Resets the font family back to the OS/browser's default sans-serif font,
this the same font stack that Normalize.css sets for the `body`.
Expand Down
19 changes: 19 additions & 0 deletions src/menus/css/menus-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
text-decoration: none;
white-space: nowrap;
}
.pure-menu a[hidden],
.pure-menu .pure-menu-heading[hidden] {
display: none;
}

.pure-menu.pure-menu-horizontal > .pure-menu-heading {
display: inline-block;
Expand All @@ -52,12 +56,18 @@
margin: 0;
vertical-align: middle;
}
.pure-menu.pure-menu-horizontal > .pure-menu-heading[hidden] {
display: none;
}
.pure-menu.pure-menu-horizontal > ul {
display: inline-block;
*display: inline;
zoom: 1;
vertical-align: middle;
}
.pure-menu.pure-menu-horizontal > ul[hidden] {
display: none;
}

.pure-menu li a { padding: 5px 20px; }

Expand All @@ -82,6 +92,9 @@
margin: 7px 2px;
overflow: hidden;
}
.pure-menu-separator[hidden] {
display: none;
}

.pure-menu-hidden {
display: none;
Expand All @@ -105,11 +118,17 @@
zoom: 1;
vertical-align: middle;
}
.pure-menu-horizontal li[hidden] {
display: none;
}

/* Submenus should still be display: block; */
.pure-menu-horizontal li li {
display: block;
}
.pure-menu-horizontal li li[hidden] {
display: none;
}

/* Content after should be down arrow */
.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after {
Expand Down
4 changes: 3 additions & 1 deletion src/menus/css/menus-paginator.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
vertical-align: top;
text-rendering: auto;
}

.pure-paginator li[hidden] {
display: none;
}

.pure-paginator .pure-button {
border-radius: 0;
Expand Down
3 changes: 3 additions & 0 deletions src/menus/css/menus-r.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
display: block;
border-bottom: 1px solid black;
}
.pure-menu-children li[hidden] {
display: none;
}
}