Skip to content

Commit

Permalink
MDL-83648 javascript dialogues: fix responsive behaviour
Browse files Browse the repository at this point in the history
visibilityChanged in the dialogue base class does important things.
Therefore if ajaxException and exception also want to do something
else in response to the visibleChange event, it should use a
different method name, rather than a name that collides with the
base class method.
  • Loading branch information
timhunt committed Nov 6, 2024
1 parent 99b5729 commit d155f85
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
var self = this;
this._keypress.detach();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
var self = this;
this._keypress.detach();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ Y.extend(EXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13,27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
if (this._keypress) {
this._keypress.detach();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ Y.extend(EXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13,27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
if (this._keypress) {
this._keypress.detach();
Expand Down
4 changes: 2 additions & 2 deletions lib/yui/src/notification/js/ajaxexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
var self = this;
this._keypress.detach();
Expand Down
4 changes: 2 additions & 2 deletions lib/yui/src/notification/js/exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ Y.extend(EXCEPTION, M.core.notification.info, {
self.hide();
}, delay);
}
this.after('visibleChange', this.visibilityChanged, this);
this.after('visibleChange', this.errorVisibilityChanged, this);
this._keypress = Y.on('key', this.hide, window, 'down:13,27', this);
this.centerDialogue();
},
visibilityChanged: function(e) {
errorVisibilityChanged: function(e) {
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
if (this._keypress) {
this._keypress.detach();
Expand Down

0 comments on commit d155f85

Please sign in to comment.