Skip to content

Commit cee45ea

Browse files
author
Chris Hart
committed
Consolidate jQueryUI buttons into _buttons.scss
Fixes: CNVS-16353 - Moved jQueryUI button classes into main button components stylesheet, so we now have all button-related styles in a single place. - Kept jQueryUI button set styles in their own stylesheet. - Moved .Button disabled styles out of the canvas-button mixin because there was no longer any reason to make them part of the mixin. Change-Id: I96d68efbb1fafc09e0d0d62c02eb886055da6434 Reviewed-on: https://gerrit.instructure.com/45354 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Colleen Palmer <colleen@instructure.com> Product-Review: Colleen Palmer <colleen@instructure.com> QA-Review: Anna Koalenz <akoalenz@instructure.com>
1 parent 5ddccc6 commit cee45ea

3 files changed

Lines changed: 27 additions & 33 deletions

File tree

app/stylesheets/components/_buttons.scss

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ listen to the "click" and "keyclick" events and add tabindex="0" and role="butto
9494
```
9595
*/
9696

97-
.btn, // <-- deprecated- do not use
97+
.btn, // <-- deprecated- do not use
9898
.Button {
99-
@if $use_new_styles { @include canvas-button(darken($canvas-neutral, 1%), $textColor, true); }
100-
@else { @include canvas-button(darken($canvas-light, 3%), $textColor, true); }
99+
@include canvas-button(darken($canvas-light, 3%), $textColor, true);
101100
border-radius: $baseBorderRadius;
102101
transition: background-color 0.2s ease-in-out;
103102
display: inline-block;
@@ -123,6 +122,12 @@ listen to the "click" and "keyclick" events and add tabindex="0" and role="butto
123122
// If not high-contrast, the "canvas-button" mixin has the :focus state share the same styles as :hover
124123
@else { &:focus { outline: none; } }
125124

125+
&.disabled, &[disabled] {
126+
cursor: not-allowed;
127+
pointer-events: none;
128+
opacity: 0.5;
129+
}
130+
126131
}
127132

128133

@@ -180,9 +185,7 @@ listen to the "click" and "keyclick" events and add tabindex="0" and role="butto
180185
input[type="submit"],
181186
input[type="reset"],
182187
input[type="button"] {
183-
&.btn-block {
184-
width: 100%;
185-
}
188+
&.btn-block, &.Button--block { width: 100%; }
186189
}
187190

188191
// Set the backgrounds
@@ -257,4 +260,20 @@ input[type="button"] {
257260
color: $textColor;
258261
background: transparent;
259262
}
263+
}
264+
265+
266+
// Handle jQueryUI-generated button classes
267+
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { @extend .ui-helper-hidden-accessible; }
268+
269+
.ui-button {
270+
position: relative;
271+
@extend .Button;
272+
&.ui-state-hover { @extend .Button:hover }
273+
&.ui-state-focus { @extend .Button:focus }
274+
&.ui-state-active {
275+
@extend .Button--active;
276+
&:hover { @extend .Button--active; }
277+
}
278+
&.ui-state-disabled { @extend .Button.disabled; }
260279
}

app/stylesheets/vendor/bootstrap/_mixins.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,7 @@
579579
box-shadow: none;
580580
}
581581
}
582-
583-
&.disabled, &[disabled] {
584-
cursor: not-allowed;
585-
pointer-events: none;
586-
opacity: 0.5;
587-
}
582+
588583
}
589584

590585
// Navbar vertical align

app/stylesheets/vendor/jqueryui/_jquery.ui.button.scss

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
@styleguide Buttons: Button Set
2+
@styleguide Button Set
33
44
We use jQuery UI button set
55
@@ -22,26 +22,6 @@ We use jQuery UI button set
2222
2323
*/
2424

25-
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { @extend .ui-helper-hidden-accessible; }
26-
27-
// DONT USE .ui-button, USE .btn INSTEAD!
28-
// it remains only because our jqueryUI widgets
29-
// (like 'dialog', and 'buttonset') generate .ui-buttons
30-
// in their markup.
31-
32-
// make .ui-button mimic .btn styles
33-
.ui-button {
34-
position: relative;
35-
@extend .Button;
36-
&.ui-state-hover { @extend .Button:hover }
37-
&.ui-state-focus { @extend .Button:focus }
38-
&.ui-state-active {
39-
@extend .Button--active;
40-
&:hover { @extend .Button--active; }
41-
}
42-
&.ui-state-disabled { @extend .Button--active; }
43-
}
44-
4525
.ui-buttonset {
4626
margin-right: 7px;
4727
.ui-button {

0 commit comments

Comments
 (0)