Opened 9 years ago

Closed 4 years ago

#12791 closed defect (patchwelcome)

Dialog: forces start zIndex to 950

Reported by: Michael Schall Owned by: bill
Priority: low Milestone: 1.13
Component: Dijit Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

The zIndex used for the dialog should look at the domNode that will be used as the dialog for a zIndex value to start with.

We have a case where we need the dialog zIndex to start higher than 950. We set the desired zIndex through css. The following change to dijit.Dialog.js makes this possible.

For backward compatibility, we will take the Math.max of how the current code calculates the zIndex and the zIndex of the domNode we will be showing (bitwise or'ed with 0 in case the zIndex of the domNode is "auto"). The Math.max should also cater for showing different domNodes with different initial zIndex defined.

  • .js

    old new  
    492492                }
    493493
    494494                // Set z-index a bit above previous dialog
    495                 var zIndex = ds[ds.length-1].dialog ? ds[ds.length-1].zIndex + 2 : 950;
     495                var zIndex = Math.max(ds[ds.length-1].dialog ? ds[ds.length-1].zIndex + 2 : 950, dojo.style(dialog.domNode, 'zIndex') | 0);
    496496                if(ds.length == 1){     // first dialog
    497497                        underlay.show();
    498498                }

Change History (6)

comment:1 Changed 9 years ago by bill

Priority: highnormal
Summary: dijit.Dialog forces start zIndex to 950Dialog: forces start zIndex to 950

I see what you are saying in general.

Note that the dijit.popup code handles this by it's _beginZIndex setting, and note that Dialogs and popups are connected since Dialogs often have popups (like a Dialog containing a DateTextBox)... so the choice of 950 for Dialogs and 1000 for popups is not an accident. Thus I'm not sure that reading the z-index of a dialog from CSS is the best solution.

The Math.max should also cater for showing different domNodes with different initial zIndex defined.

I don't know why a user would define different z-indexes for different dialogs.

comment:2 Changed 9 years ago by Michael Schall

I would be fine with an option to set the begin index. I just thought reading it from css would be a cleaner way to do it. This way the developer doesn't have to set a "private" variable (which can change between minor versions) to change where the zIndex starts.

The Math.max is really just to keep backward compatibility with the hard coded 950. But also guarantees that the zIndex used is always ever increasing no matter what the order of dialogs opening and their css zIndex values.

comment:3 Changed 8 years ago by Douglas Hays

Owner: set to bill

comment:4 Changed 7 years ago by bill

Priority: highlow

comment:5 Changed 7 years ago by bill

Milestone: tbdfuture

comment:6 Changed 4 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 4+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.