-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Button Re-write #1333
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
Button Re-write #1333
Conversation
<div class="demo-description"> | ||
<p>Some buttons with various combinations of text and icons.</p> | ||
</div> | ||
<div class="widget"> | ||
<h1>Widget</h1> | ||
<a>Button with icon only</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing an href
attribute. Or it should be a <button>
as well.
If you remove the
Screenshot Chrome 37 / MBP Retina: Screenshot Firefox 32 / MBP Retina: |
@jaspermdegroot this is fixed and also fixed the off by one i mentioned but in firefox icon only buttons are still a little short can you try and take a look at this? |
I pulled the branch this morning and I don't see any commits after that. Where is it fixed? Update: @arschmitz - Nevermind, I don't know what went wrong but I forked the repo again and checked out the button branch and the problem has been fixed. |
@@ -28,81 +29,79 @@ | |||
} | |||
/* to make room for the icon, a width needs to be set here */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be removed
Update: We do need to set a width for anchor elements, so the comment should stay and we should revert the change where the width setting has been removed.
PR #1340 contains the fix for the controlgroup icon-only button height problem on Firefox. |
I added 2 more commits to #1340 to fix the following issues:
|
@jzaefferer this now includes the commits from @jaspermdegroot to fix controlgroup and various fixes / updates for demos. |
@@ -11,7 +11,7 @@ | |||
<link rel="stylesheet" href="../demos.css"> | |||
<script> | |||
$(function() { | |||
$( "input[type=submit], a, button" ) | |||
$( ".widget input[type=submit], .widget a, .widget button" ) | |||
.button() | |||
.click(function( event ) { | |||
event.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's apply the preventDefault()
to all buttons on this page, not just the widget buttons.
One button unit test is currently failing. |
<h2>Checkbox</h2> | ||
|
||
<fieldset> | ||
<legend>Rating</legend> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an improvement and more demo-like. Though as-is a bit irritating: It looks like its a part of a rating UI, where it wouldn't make sense to select multiple ratings. Maybe change the legend to "Filter by rating"?
As for the markup, shouldn't they all share the same name and have a value attribute? Maybe use "rating" instead of "checkbox"?
Can checkboxradio also support a "CSS only" mode? |
formElement.off( "reset" + this.eventNamespace, formResetHandler ); | ||
formElement.on( "reset" + this.eventNamespace, formResetHandler ); | ||
|
||
// If it is null the user set it explicitly to null so we need to check the dom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's uppercase "dom" to "DOM".
Conflicts: ui/checkboxradio.js
Cant be sane
This widget replaces the buttonset widget
Methods of new widgets added via the items option.
}, | ||
|
||
_enhance: function() { | ||
var checked = this.element.is( ":checked" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it faster to use this.element.prop( "checked" )
?
The negative margin for `ui-button`` in horizontal controlgroups still leaves space between some of the buttons. Which buttons depends on what browser you're on and what font size you use. In case we stick to
The width of the select button in a vertical controlgroup should be |
// we don't search against the document in case the element | ||
// is disconnected from the DOM | ||
ancestor = this.element.parents().last(); | ||
labelSelector = "label[for='" + this.element.attr("id") + "']"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to selector-escape the ID, in case it contains funky characters which will render the selector invalid:
... + this.element.attr( "id" ).replace( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1" ) + ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should follow the SOP and put the regex into a variable to the top of the file, so we don't recompile it.
I agree with @jaspermdegroot regarding control group issues might be fixed by using floats instead of keeping them inline-blocks with the negative margin adjustment. As much as I like inline-blocks, if you're dealing with a case where elements need to be right up against each other, floats typically are the better solution. The negative margins css hack for inline-blocks can be tricky, and the alternative is making sure there are no spaces between your elements in the html, which tends to make the html look messy. |
@jaspermdegroot Turns out its actually not possible to set width auto on selectmenu buttons in a vertical controlgroup which is why I was not. Selectmenu sets an actual width on the button via JS no matter what setting auto actually breaks this and makes it tiny. It seems like there should be a way to completely stop the selectmenu from setting a width for cases like this where you want it to fill a containers width. /cc @fnagel |
Closing replaced by #1415 |
I don't see that problem. The screenshot below shows the result when I set With current CSS, changing the font-size to 22px results in this: Using Ps. I think you forgot to actually close this PR :) |
@jaspermdegroot exactly and using |
Well, you can override it. Just need to use Will the new selectmenu widget still use JS to set a width as far as you know? I was wondering what problem had to be solved that couldn't be done with CSS only. |
@jaspermdegroot I'm not sure what you mean by new selectmenu widget? This is the UI widget which just landed in 1.11 ( the current stable version ) |
@arschmitz - Sorry, I had Mobile in my mind where we didn't adopt the new selectmenu yet. |
This replaces PR #1216
This includes new widget controlgroup which replaces buttonset
Current known issues