Dialog: make focusing on _savedFocus optional for dialog.hide
dialog.hide connects to onEnd
of this._fadeOut
to set the focus on this._savedFocus
. This is the logical and obviously correct behaviour but introduces the following problem: if the dialog changes the content of the page "behind" the dialog and wants to scroll to that change's location, setting the focus on the previously focused element "onEnd" makes the browser scroll right back to that element.
By introducing a new boolean property (e.g. "refocus: true") to the dialog class for programmers to set to "false" (if needed) and performing the following check in the hide function would be very convenient.
if (this.refocus) {
this.connect(this._fadeOut,"onEnd",dojo.hitch(this,function(){
dijit.focus(this._savedFocus);
}));
}
Change History (5)
Summary: |
make focusing on _savedFocus optional for dialog.hide →
Dialog: make focusing on _savedFocus optional for dialog.hide
|
Resolution: |
→ fixed
|
Status: |
new →
closed
|
(In [12449]) fixes #5613 - introduces an optional 'refocus' attrib to dialog, so you can (while the dialog is open) change the intended focus after closing.