MDL-74214 forms: re-calculate calendar panel zIndex each time.

The previous iteration only calculated it's zIndex value on
initial load. This meant that any nodes added subsequent to this
would not be taken into account (e.g. modal forms).
This commit is contained in:
Paul Holden
2022-03-15 13:41:06 +00:00
parent 967d9b2546
commit 29c00fc100
4 changed files with 35 additions and 29 deletions
@@ -80,16 +80,18 @@ M.form.dateselector = {
this.panel.render(document.body);
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
this.panel.on('focus', function() {
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
this.panel.on('heightChange', this.fix_position, this);
File diff suppressed because one or more lines are too long
@@ -80,16 +80,18 @@ M.form.dateselector = {
this.panel.render(document.body);
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
this.panel.on('focus', function() {
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
this.panel.on('heightChange', this.fix_position, this);
+11 -9
View File
@@ -76,16 +76,18 @@ M.form.dateselector = {
this.panel.render(document.body);
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
this.panel.on('focus', function() {
var highestzindex = 0;
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
}, this);
// Only set the zindex if we found a wrapper.
var zindexvalue = (highestzindex + 1).toString();
Y.one('#dateselector-calendar-panel').setStyle('zIndex', zindexvalue);
this.panel.on('heightChange', this.fix_position, this);