Opened 10 years ago

Closed 9 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:


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. (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 10 years ago by Scott González

Keywords: modal added
Status: newopen

comment:2 Changed 10 years ago by tj.vantoll

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:

// increase zIndex of sw, se, ne, nw axis
//TODO : this modifies original option
if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });

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 -

Last edited 10 years ago by tj.vantoll (previous) (diff)

comment:3 Changed 10 years ago by Scott González

Landed the resizable change in 6150abae49f77a3b2f67c39a3c60a06792b4de8f.

comment:4 Changed 9 years ago by Scott González


comment:5 Changed 9 years ago by Jörn Zaefferer

tj.vantoll, could you retest this against master? The overlay changes should have fixed this.

comment:6 Changed 9 years ago by tj.vantoll

joern.zaefferer Looks like this is still an issue in master -

.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 9 years ago by tj.vantoll

Summary: Modal dialog does not disable resizables on the pageDialog: Modal dialogs do not disable resizables on the page

comment:8 Changed 9 years ago by Scott González

Yeah, this is purely a z-index problem. We should fix it by changing resizable handles to something smaller, like 90.

comment:9 Changed 9 years ago by Jörn Zaefferer

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 9 years ago by Scott González

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 9 years ago by tj.vantoll

1000 --> 90?

Can anybody think of any adverse effects of that change? Otherwise I can send a pull request.

comment:12 Changed 9 years ago by Scott González

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 9 years ago by TJ VanToll

Resolution: fixed
Status: openclosed

Resizable: Modified the default z-index value of resizable handles. Fixed #7960 - Dialog: Modal dialogs do not disable resizables on the page.

Changeset: 0cd470b0d5f8c617e761c4a6c90aeea4e3f54128

Note: See TracTickets for help on using tickets.