Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 2c2be73

Browse files
Button: Class ui-input-btn for all input buttons instead of ui-submit. Adjusted rules for buttons in field containers.
1 parent bb2eda5 commit 2c2be73

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

css/structure/jquery.mobile.button.css

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* TODO: This file only contains CSS for the button widget and should be renamed to jquery.mobile.forms.button.css */
12
button.ui-btn {
23
-webkit-box-sizing: border-box;
34
-moz-box-sizing: border-box;
@@ -21,7 +22,6 @@ button.ui-btn-icon-notext {
2122
margin-right: 0;
2223
margin-left: 0;
2324
}
24-
2525
/* Hide the native input element */
2626
.ui-btn > input[type="button"],
2727
.ui-btn > input[type="submit"],
@@ -52,11 +52,39 @@ button.ui-btn-icon-notext {
5252
.ui-state-disabled input[type="reset"] {
5353
display: none;
5454
}
55-
56-
.ui-field-contain .ui-btn.ui-submit { margin: 0; }
57-
label.ui-submit { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; display: block; }
55+
label.ui-input-btn {
56+
font-size: 16px;
57+
line-height: 1.4;
58+
font-weight: normal;
59+
margin: 0 0 .3em;
60+
display: block;
61+
}
62+
.ui-field-contain > .ui-input-btn,
63+
.ui-field-contain > button.ui-btn {
64+
margin: 0;
65+
}
5866
@media (min-width: 28em) {
59-
.ui-field-contain label.ui-submit { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0; }
60-
.ui-field-contain .ui-btn.ui-submit { width: 78%; display: inline-block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; }
61-
.ui-hide-label .ui-btn.ui-submit { width: auto; display: block; }
67+
.ui-field-contain label.ui-input-btn {
68+
vertical-align: top;
69+
display: inline-block;
70+
width: 20%;
71+
margin: 0 2% 0 0;
72+
}
73+
.ui-field-contain > .ui-input-btn,
74+
.ui-field-contain > button.ui-btn {
75+
width: 78%;
76+
display: inline-block;
77+
-webkit-box-sizing: border-box;
78+
-moz-box-sizing: border-box;
79+
-ms-box-sizing: border-box;
80+
box-sizing: border-box;
81+
}
82+
.ui-hide-label > .ui-input-btn {
83+
width: auto;
84+
display: block;
85+
}
86+
.ui-hide-label > button.ui-btn {
87+
width: 100%;
88+
display: block;
89+
}
6290
}

css/structure/jquery.mobile.core.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,5 @@ div.ui-mobile-viewport { overflow-x: hidden; }
232232
.ui-nojs { position: absolute; left: -9999px; }
233233

234234
/* accessible content hiding */
235-
.ui-hide-label label.ui-input-text, .ui-hide-label label.ui-select, .ui-hide-label label.ui-slider, .ui-hide-label label.ui-submit, .ui-hide-label .ui-controlgroup-label,
235+
.ui-hide-label label.ui-input-text, .ui-hide-label label.ui-select, .ui-hide-label label.ui-slider, .ui-hide-label label.ui-input-btn, .ui-hide-label .ui-controlgroup-label,
236236
.ui-hidden-accessible { position: absolute !important; left: -9999px; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }

js/widgets/forms/button.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ $.widget( "mobile.button", $.mobile.widget, {
2828
classes = "ui-btn";
2929

3030
if ( isInput ) {
31+
classes += " ui-input-btn";
32+
3133
// TODO: When we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
3234
/* if ( $el[0].className.length ) {
3335
classes = $el[0].className;
@@ -40,11 +42,6 @@ $.widget( "mobile.button", $.mobile.widget, {
4042
classes += " ui-btn-right";
4143
}
4244

43-
if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) {
44-
classes += " ui-submit";
45-
}
46-
$( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" );
47-
4845
this.button = $( "<div></div>" )
4946
[ "text" ]( $el.val() )
5047
.insertBefore( $el )
@@ -66,6 +63,8 @@ $.widget( "mobile.button", $.mobile.widget, {
6663
this.button = $el.addClass( classes );
6764
}
6865

66+
$( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-input-btn" );
67+
6968
$.extend( this, {
7069
isInput: isInput,
7170
buttonClasses: classes,

0 commit comments

Comments
 (0)