Opened 12 years ago
Closed 11 years ago
#7960 closed bug (fixed)
Dialog: Modal dialogs do not disable resizables on the page
Reported by: | jjoemb | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.10.0 |
Component: | ui.dialog | Version: | 1.8.16 |
Keywords: | modal | Cc: | |
Blocked by: | Blocking: |
Description
EXPECT: Resizable DIV on a page with a modal dialog should not be resizable. ACTUAL: User can resize the resizable when the modal dialog is up.
I believe this is due to the fact that the resize handle z-index is 99999 but the modal dialog overlay is around 1000.
http://jsfiddle.net/mBfHF/ (The button is simply intended to show that other elements are disabled.)
jQuery: 1.7.1 jQuery UI: 1.8.16 (and previous versions that jsfiddle supports)
Browsers: FF latest, Chrome latest, IE 9
Change History (14)
comment:1 Changed 12 years ago by
Keywords: | modal added |
---|---|
Status: | new → open |
comment:3 Changed 11 years ago by
Landed the resizable change in 6150abae49f77a3b2f67c39a3c60a06792b4de8f.
comment:4 Changed 11 years ago by
Milestone: | 1.9.0 → 1.10.0 |
---|
comment:5 Changed 11 years ago by
tj.vantoll, could you retest this against master? The overlay changes should have fixed this.
comment:6 Changed 11 years ago by
joern.zaefferer Looks like this is still an issue in master - http://jsfiddle.net/tj_vantoll/TmmQ7/.
.ui-front
has a z-index
of 100 and the resizable
handles have a z-index
of 1000. If I pass in zIndex: 99
to resizable
on the above fiddle the resizable
can no longer be resized.
comment:7 Changed 11 years ago by
Summary: | Modal dialog does not disable resizables on the page → Dialog: Modal dialogs do not disable resizables on the page |
---|
comment:8 Changed 11 years ago by
Yeah, this is purely a z-index problem. We should fix it by changing resizable handles to something smaller, like 90.
comment:9 Changed 11 years ago by
Do we need a separate resizable ticket for a change like that? Or would we commit that resizable change pointing at this dialog ticket?
comment:10 Changed 11 years ago by
We can just reference this ticket. It'd be one of the few commits that has a different component listed at the front of the commit and in the ticket reference.
comment:11 Changed 11 years ago by
https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.resizable.js#L45.
1000 --> 90?
Can anybody think of any adverse effects of that change? Otherwise I can send a pull request.
comment:12 Changed 11 years ago by
That should be all that's required. The only adverse effect would be users who have other elements with high z-indexes that overlap resize handles, which seems like it would probably result in bad UX anyway (and it's super easy for the user to fix).
comment:14 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Resizable: Modified the default z-index value of resizable handles. Fixed #7960 - Dialog: Modal dialogs do not disable resizables on the page.
Changeset: 0cd470b0d5f8c617e761c4a6c90aeea4e3f54128
I can confirm the bug and that the z-index difference is causing this issue. Simply changing the z-index declaration on line 11 of jquery.ui.resizable.css to "999" instead of "99999" fixes this particular situation.
However, since z-index is a configurable parameter of both dialog and resizable, this type of solution probably isn't going to work.
The only other thing I could think of was to add a marker class to resizable elements when a modal is opened and remove the class when the dialog is closed. But when you start to think about the fact that the dialog itself can be resizable, and a dialog can technically have resizable elements within it, and that you can have multiple dialogs open at once... this type of solution gets really messy.
Since the zIndex is a configurable option for both of these, personally I think the best way around this is to explicitly pass in the zIndex values that you'd like to use for each individual call. Otherwise this will quickly turn into a zIndex arms race.
The one issue with this is that currently, the value passed into the resizable plugin will only be applied to the corners. The non-corner handles will take the z-index of 99999 from CSS. Lines 106-108 of jquery.ui.resizable.js:
I'm not sure why this is, it seems like you'd want the same zIndex values on all of the sides for consistency and to avoid issues like this one, maybe I'm wrong. I submitted a pull request to change apply the zIndex passed in to all handles - https://github.com/jquery/jquery-ui/pull/561