MDL-47734 core: Do not set scrolltop on fixed dialogues

Fixed position dialogues use a different xy positioning than standard
dialogues so cannot use the scrollTop positioning method.
This commit is contained in:
Andrew Nicols 2014-10-27 11:22:30 +08:00
parent 42b6b39136
commit 2af57bdbc5
4 changed files with 32 additions and 32 deletions

View File

@ -119,7 +119,6 @@ Y.extend(DIALOGUE, Y.Panel, {
if (this.get('render')) {
this.render();
}
this.makeResponsive();
this.after('visibleChange', this.visibilityChanged, this);
if (this.get('center')) {
this.centerDialogue();
@ -152,10 +151,14 @@ Y.extend(DIALOGUE, Y.Panel, {
if (!this.get('center')) {
this._originalPosition = bb.getXY();
}
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
if (bb.getStyle('position') !== 'fixed') {
// If the boundingBox has been positioned in a fixed manner, then it will not position correctly to scrollTop.
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
}
}, this);
// Remove the dialogue from the DOM when it is destroyed.
@ -274,8 +277,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* @method makeResponsive
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
content;
var bb = this.get('boundingBox');
if (this.shouldResizeFullscreen()) {
// Make this dialogue fullscreen on a small screen.
@ -290,15 +292,12 @@ Y.extend(DIALOGUE, Y.Panel, {
'height' : null,
'right' : null,
'bottom' : null});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
} else {
if (this.get('responsive')) {
// We must reset any of the fullscreen changes.
bb.removeClass(DIALOGUE_FULLSCREEN_CLASS)
.setStyles({'width' : this.get('width'),
'height' : this.get('height')});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
}
}
},
@ -327,6 +326,7 @@ Y.extend(DIALOGUE, Y.Panel, {
if (hidden) {
bb.addClass(DIALOGUE_HIDDEN_CLASS);
}
this.makeResponsive();
},
/**
* Return whether this dialogue should be fullscreen or not.

File diff suppressed because one or more lines are too long

View File

@ -119,7 +119,6 @@ Y.extend(DIALOGUE, Y.Panel, {
if (this.get('render')) {
this.render();
}
this.makeResponsive();
this.after('visibleChange', this.visibilityChanged, this);
if (this.get('center')) {
this.centerDialogue();
@ -152,10 +151,14 @@ Y.extend(DIALOGUE, Y.Panel, {
if (!this.get('center')) {
this._originalPosition = bb.getXY();
}
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
if (bb.getStyle('position') !== 'fixed') {
// If the boundingBox has been positioned in a fixed manner, then it will not position correctly to scrollTop.
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
}
}, this);
// Remove the dialogue from the DOM when it is destroyed.
@ -274,8 +277,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* @method makeResponsive
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
content;
var bb = this.get('boundingBox');
if (this.shouldResizeFullscreen()) {
// Make this dialogue fullscreen on a small screen.
@ -290,15 +292,12 @@ Y.extend(DIALOGUE, Y.Panel, {
'height' : null,
'right' : null,
'bottom' : null});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
} else {
if (this.get('responsive')) {
// We must reset any of the fullscreen changes.
bb.removeClass(DIALOGUE_FULLSCREEN_CLASS)
.setStyles({'width' : this.get('width'),
'height' : this.get('height')});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
}
}
},
@ -327,6 +326,7 @@ Y.extend(DIALOGUE, Y.Panel, {
if (hidden) {
bb.addClass(DIALOGUE_HIDDEN_CLASS);
}
this.makeResponsive();
},
/**
* Return whether this dialogue should be fullscreen or not.

View File

@ -90,7 +90,6 @@ Y.extend(DIALOGUE, Y.Panel, {
if (this.get('render')) {
this.render();
}
this.makeResponsive();
this.after('visibleChange', this.visibilityChanged, this);
if (this.get('center')) {
this.centerDialogue();
@ -123,10 +122,14 @@ Y.extend(DIALOGUE, Y.Panel, {
if (!this.get('center')) {
this._originalPosition = bb.getXY();
}
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
if (bb.getStyle('position') !== 'fixed') {
// If the boundingBox has been positioned in a fixed manner, then it will not position correctly to scrollTop.
bb.setStyles({
top: w.get('scrollTop'),
left: w.get('scrollLeft')
});
}
}, this);
// Remove the dialogue from the DOM when it is destroyed.
@ -245,8 +248,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* @method makeResponsive
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
content;
var bb = this.get('boundingBox');
if (this.shouldResizeFullscreen()) {
// Make this dialogue fullscreen on a small screen.
@ -261,15 +263,12 @@ Y.extend(DIALOGUE, Y.Panel, {
'height' : null,
'right' : null,
'bottom' : null});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
} else {
if (this.get('responsive')) {
// We must reset any of the fullscreen changes.
bb.removeClass(DIALOGUE_FULLSCREEN_CLASS)
.setStyles({'width' : this.get('width'),
'height' : this.get('height')});
content = Y.one('#' + this.get('id') + ' .' + CSS.BODY);
}
}
},
@ -298,6 +297,7 @@ Y.extend(DIALOGUE, Y.Panel, {
if (hidden) {
bb.addClass(DIALOGUE_HIDDEN_CLASS);
}
this.makeResponsive();
},
/**
* Return whether this dialogue should be fullscreen or not.