Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#5613 closed enhancement (fixed)

Dialog: make focusing on _savedFocus optional for dialog.hide

Reported by: guest Owned by:
Priority: high Milestone: 1.1
Component: Dijit Version: 1.0
Keywords: dialog hide focus Cc:
Blocked By: Blocking:

Description

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)

comment:1 Changed 11 years ago by Adam Peller

Milestone: 1.0.3

comment:2 Changed 11 years ago by bill

Summary: make focusing on _savedFocus optional for dialog.hideDialog: make focusing on _savedFocus optional for dialog.hide

comment:3 Changed 11 years ago by dante

Resolution: fixed
Status: newclosed

(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.

comment:4 Changed 11 years ago by Adam Peller

Milestone: 1.1

comment:5 Changed 10 years ago by bill

(In [18864]) The programmatic dialog button was specifically added to this test file to test that refocusing (after dialog close) is working, so rollback changes from [12449] that turn off the refocusing feature for that dialog. Refs #5613.

Note: See TracTickets for help on using tickets.