Opened 13 years ago
Closed 12 years ago
#6989 closed defect (fixed)
[patch] [ccla] Visual indicator for focus disappears immediately after sorting.
Reported by: | Joseph Scheuhammer | Owned by: | Nathan Toone |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | DojoX Grid | Version: | 1.1.1 |
Keywords: | a11y keyboard | Cc: | Becky Gibson, davidb |
Blocked By: | Blocking: |
Description
Steps to reproduce:
- Place focus on a cell by clicking on it. The row is highlighted, and the cell is decorated with a dashed outline focus indicator.
- Click a column sorter. The row is still highlighted, but the focus indicator on the cell is removed.
- Press the right arrow key. The focus indicator reappears on the cell just right of the cell selected at step one.
It's not clear visually where focus is after clicking the sort button in the column header. Step three implies that it was on the cell selected at step one, but is it? If so, the focus indicator should be on that cell.
Attachments (2)
Change History (12)
comment:1 Changed 13 years ago by
Summary: | Visual indicator for focus disappears immeidately after sorting. → Visual indicator for focus disappears immediately after sorting. |
---|
comment:2 follow-up: 3 Changed 13 years ago by
Changed 13 years ago by
Attachment: | 6989.patch added |
---|
comment:3 Changed 13 years ago by
Replying to clown, specifically:
This does not work in IE6/7 the first time the column header is clicked. Thereafter it's fine.
It seems that focus moves up to the document, but I can't determine why.
Steps to reproduce:
- Apply 6989.patch (see above).
- Load .../dojox/grid/tests/test_keyboard.html in IE6/7.
- Click a column header to invoke sort.
- After sort is finished, press right arrow to move focus to next column header.
The next column header will acquire focus briefly, but then focus moves to the top of the document. Pressing the TAB key next moves focus to the "dojox.grid.Grid Basic Test" heading.
comment:4 Changed 12 years ago by
Keywords: | a11y keyboard added |
---|
comment:5 Changed 12 years ago by
Milestone: | 1.2 → 1.3 |
---|
comment:6 Changed 12 years ago by
Hypothesis: this may be the result of a race condition.
- The sort operation is modifying the DOM.
- The refocus operation (in 6869.patch) is attempting to put focus back on the element that had focus before the sort.
If focus is applied before all DOM modifications are complete, then focus will be on an element that is longer present.
This may also explain #7676 and #7677 where arrowing or paging down below the viewable parts of the grid moves focus to the wrong place. Moving down in that way triggers the loading of more data, and focus may again be applied before the DOM modification is finished.
Is there a way to be notified when sorting is complete? Investigating...
comment:7 Changed 12 years ago by
Owner: | changed from Bryan Forbes to Nathan Toone |
---|
Reassigning to me
comment:8 Changed 12 years ago by
Milestone: | 1.3 → future |
---|
Changed 12 years ago by
Attachment: | 6989_bg.patch added |
---|
comment:9 Changed 12 years ago by
Milestone: | future → 1.3 |
---|---|
Summary: | Visual indicator for focus disappears immediately after sorting. → [patch] [ccla] Visual indicator for focus disappears immediately after sorting. |
6989_bg.patch (note this patch also contains the fix for #7676) connects to the postRender() method and set focus back to the header when that function is complete. There are still some issues - for example if you have focus on a cell in column 2, shift-tab to focus on column header 2, arrow to column header 0, press enter to sort, focus goes back to column header 2 because that is the column header that is associated with the selected cell (the cell that had focus before sorting). The grid currently doesn't remember the index of the last focused header and rather than add that behavior I can live with the quirkiness.
Also, there are some issues when the row index that was selected is no longer in the view. I think this is related to #7304 and selection following rowIndex rather than the cell. To work around this if the current rowIndex is undefined in the view, I scroll to it. It is a bit odd, but no worse than before my change where focus was completely lost after a sort and doesn't make mouse behavior any worse, either. You can see this by using the keyboard to page down until the first cell in row 33 in test_data_grid_large.html has focus, shift tab back to focus the column header, press enter to sort, data is scrolled when it is redrawn so that a selected row is visible. Try without the patch and no selected row is visible after the sort.
comment:10 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Attaching patch that partially fixes. This fix re-focuses the header that was used to invoke the sort (either by clicking on the header, or pressing space bar when focussed).
This does not work in IE6/7 the first time the column header is clicked. Thereafter it's fine.
The root of the problem is that during a sort, parts of the DOM are deleted and replaced with new markup, including the element that had focus. The patch code figures out where focus was just before the sort, and puts it back there.
Another side effect of the DOM destruction is that the scroller loses track of its position such that after a sort, the scroll position is reset to (0,0). I've filed another ticket regarding this -- see #7273.