Skip to content

Commit 50a7a3d

Browse files
committed
Controlgroup: Fixes for spinner
1 parent 3330634 commit 50a7a3d

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

demos/controlgroup/default.html

-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@
2626
$( ".controlgroup-vertical" ).controlgroup({
2727
"direction": "vertical"
2828
});
29-
$( ".button" ).button();
3029
</script>
3130
</head>
3231
<body>
3332
<div class="widget">
3433
<h1>Controlgroup</h1>
3534
<fieldset>
3635
<legend>Rental Car</legend>
37-
<button class="button">button</button>
3836
<div class="controlgroup">
3937
<select id="car-type">
4038
<option>Compact car</option>

themes/base/controlgroup.css

+24-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
box-sizing: border-box;
3434
}
3535
.ui-controlgroup .ui-controlgroup-label {
36-
font-size: .83em;
37-
padding: .6em 1em;
36+
padding: .4em 1em;
37+
}
38+
.ui-controlgroup .ui-controlgroup-label span {
39+
font-size: 80%;
3840
}
3941
.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item {
4042
border-left: none;
@@ -45,3 +47,23 @@
4547
.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content {
4648
border-right: none;
4749
}
50+
.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content {
51+
border-bottom: none;
52+
}
53+
54+
/* Spinner specific style fixes */
55+
.ui-controlgroup-vertical .ui-spinner {
56+
padding-right: .4em;
57+
}
58+
.ui-controlgroup-vertical .ui-spinner-input {
59+
margin: .4em;
60+
padding: 0;
61+
62+
/* Support IE8, Android < 4.4 */
63+
width: 85%;
64+
width: calc( 100% - 22px );
65+
}
66+
.ui-controlgroup-vertical .ui-spinner .ui-spinner-up {
67+
border-top-style: solid;
68+
}
69+

ui/widgets/controlgroup.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ return $.widget( "ui.controlgroup", {
9797
} );
9898
} else if ( selector && widget === "controlgroupLabel" ) {
9999
labels = that.element.find( selector );
100+
labels.each( function() {
101+
$( this ).contents().wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
102+
} );
100103
that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
101104
Array.prototype.push.apply( childWidgets, labels.get() );
102105
}
@@ -117,9 +120,9 @@ return $.widget( "ui.controlgroup", {
117120
},
118121

119122
_updateCornerClass: function( element, position ) {
120-
var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right",
121-
add =
122-
this._buildSimpleOptions( position, this.options.direction, "label" ).classes.label;
123+
var direction = this.options.direction === "vertical"
124+
remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right",
125+
add = this._buildSimpleOptions( position, direction, "label" ).classes.label;
123126

124127
this._removeClass( element, null, remove );
125128
this._addClass( element, null, add );
@@ -219,7 +222,7 @@ return $.widget( "ui.controlgroup", {
219222
$.each( [ "first", "last" ], function( index, value ) {
220223
var instance = children[ value ]().data( "ui-controlgroup-data" );
221224

222-
if ( that[ "_" + instance.widgetName + "_options" ] ) {
225+
if ( instance && that[ "_" + instance.widgetName + "_options" ] ) {
223226
instance.element[ instance.widgetName ](
224227
that[ "_" + instance.widgetName + "_options" ](
225228
value,

0 commit comments

Comments
 (0)