-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Sortable: inject css rule to style the cursor. Fixed #7389 - 'cursor' option didn't override CSS cursor settings #914
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
Conversation
…sortable: 'cursor' option didn't override CSS cursor settings
Considering the fact that this would prevent any mouse events from firing on "real" elements during a sort, I don't think this is a good solution. |
I guess if we just injected something like |
Appending a stylesheet does not work with IE, but the old inline css change to the body does, so I added that back. Tested for Google Chrome v24, Firefox 17 and 18, Safari 5.1.7, Opera 12.14 and IE 7, 8 and 9. |
@@ -86,6 +86,16 @@ $.widget("ui.sortable", $.ui.mouse, { | |||
|
|||
}, | |||
|
|||
_createCursorStylesheet: function( cursor ) { | |||
$stylesheet = $("<style>"); |
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.
Does $( "<style>*{ cursor: move !important; }</style>" ).appendTo( "body" )
not work in all browsers? Last I checked (a few years ago), it did.
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.
Indeed it does! Except for IE.
We're getting close :-) There are a few changes that need to be made, but before having you change stuff that might go away, can you see if using |
Since this is going to land soon, can you sign our CLA? |
Nope, adding |
Ok, thanks for checking. I didn't think it would make a difference, but figured we should try all possible tricks before having different logic for different browsers. I'll do inline comment for the changes. |
this._storedCursor = $("body").css("cursor"); | ||
} | ||
$("body").css("cursor", o.cursor); | ||
if( o.cursor !== "auto" ) { // cursor option |
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 should probably be !o.cursor || o.cursor !== "auto"
. "auto"
is a silly default, null
should've been used, but that's out of scope for this change.
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 think you meant o.cursor && o.cursor !== "auto"
;-)
All done. |
Thanks, landed in a692bf9. |
Fixed #7389 - sortable: 'cursor' option didn't override CSS cursor settings
Overrides the CSS cursor styles of the page's elements by injecting a stylesheet.