Opened 7 years ago

Closed 7 years ago

#14657 closed defect (wontfix)

dojox.grid steals focus when it gets updated

Reported by: cc Owned by: Evan
Priority: low Milestone: 1.8
Component: DojoX Grid Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description

I have a dojox.grid and a textbox on the same page. A background service updates the dojox.grid by adding, removing and editing items. There is an scenario where the grid will steal focus from other controls unexpectedly.

1) Load a page that contains a dojox.grid and a textbox.

2) Click on a header in the grid to sort by a column.

3) Focus on the textbox.

4) Something updates the grid (adds an item, for example).

5) Textbox loses focus, interrupting the user from typing into it.

The following is a temporary fix that I use to prevent this from happening:

dojox.grid._FocusManager.prototype._delayedHeaderFocus = function(){
		if(this.isNavHeader()){
			this.focusHeader();
			//this.grid.domNode.focus();
		}
	}

Change History (7)

comment:1 Changed 7 years ago by cc

Should have said dojox.grid.DataGrid? to be precise.

comment:2 Changed 7 years ago by bill

Component: GeneralDojoX Grid
Owner: set to Evan
Priority: highundecided

comment:3 Changed 7 years ago by Evan

Not sure why it's put there since it's has been there for a long time. But putting "this.grid.domNode.focus()" in "_delayedHeaderFocus()" is weird as the purpose is to focusing header rather grid.body. After a through test, removing that line is safe.

But I'm not sure why removing that line fixes your issue, as Grid is still putting focus on its header when refreshed/re-rendered.

comment:4 Changed 7 years ago by Evan

Resolution: fixed
Status: newclosed

In [28088]:

Fixes #14657, by removing the unreasonable "this.grid.domNode.focus()" from "_delayedHeaderFocus()"

comment:5 Changed 7 years ago by Evan

Milestone: tbd1.8
Priority: undecidedlow

comment:6 Changed 7 years ago by Evan

Resolution: fixed
Status: closedreopened

comment:7 Changed 7 years ago by Evan

Resolution: wontfix
Status: reopenedclosed

This issue won't be 100% fixed without significant changes to Grid focusing logic - Grid will try to focus its header or cell body each time it's refreshed or new pages of rows are rendered. E.g. invoking

grid.scrollToRow(xxx)
grid.setStore()/setStructure()
... many more ways

will all result to this issue, considering the concentrated efforts on dgrid and gridx, closing this as won't fix

Note: See TracTickets for help on using tickets.