fix table focus issue (#17970)

* fix table focus issue

* fix hygiene error

* web
This commit is contained in:
Alan Ren
2021-12-21 12:46:48 -08:00
committed by GitHub
parent f8e4969ab1
commit af5575a852
7 changed files with 12 additions and 38 deletions

View File

@@ -99,7 +99,7 @@
"sanitize-html": "1.19.1",
"semver-umd": "^5.5.7",
"spdlog": "^0.13.0",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.34",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.35",
"sudo-prompt": "9.2.1",
"tas-client-umd": "0.1.4",
"turndown": "^7.0.0",

View File

@@ -38,7 +38,7 @@
"sanitize-html": "1.19.1",
"semver-umd": "^5.5.7",
"spdlog": "^0.13.0",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.34",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.35",
"turndown": "^7.0.0",
"turndown-plugin-gfm": "^1.0.2",
"tas-client-umd": "0.1.4",

View File

@@ -27,7 +27,7 @@
"rxjs": "5.4.0",
"sanitize-html": "1.19.1",
"semver-umd": "^5.5.7",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.34",
"slickgrid": "github:Microsoft/SlickGrid.ADS#2.3.35",
"turndown": "^7.0.0",
"turndown-plugin-gfm": "^1.0.2",
"tas-client-umd": "0.1.4",

View File

@@ -326,9 +326,9 @@ semver-umd@^5.5.7:
resolved "https://registry.yarnpkg.com/semver-umd/-/semver-umd-5.5.7.tgz#966beb5e96c7da6fbf09c3da14c2872d6836c528"
integrity sha512-XgjPNlD0J6aIc8xoTN6GQGwWc2Xg0kq8NzrqMVuKG/4Arl6ab1F8+Am5Y/XKKCR+FceFr2yN/Uv5ZJBhRyRqKg==
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.34":
version "2.3.34"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/8cecf97e731bbbb012fd37932b8380ea1eab4961"
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.35":
version "2.3.35"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/f49b033a01a8ce6325ea39972284c004a4f9a86b"
source-map@^0.6.1:
version "0.6.1"

View File

@@ -728,9 +728,9 @@ semver@^5.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.34":
version "2.3.34"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/8cecf97e731bbbb012fd37932b8380ea1eab4961"
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.35":
version "2.3.35"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/f49b033a01a8ce6325ea39972284c004a4f9a86b"
smart-buffer@^4.1.0:
version "4.1.0"

View File

@@ -80,24 +80,6 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
this._container = document.createElement('div');
this._container.className = 'monaco-table';
this._register(DOM.addDisposableListener(this._container, DOM.EventType.FOCUS, (e: FocusEvent) => {
// the focus redirection should only happen when the event target is the container (using keyboard navigation)
if (e.target && this._container === e.target && !this.grid.getActiveCell() && this._data.getLength() > 0) {
// When the table receives focus and there are currently no active cell, the focus should go to the first focusable cell.
let cellToFocus = undefined;
for (let col = 0; col < this.columns.length; col++) {
// some cells are not keyboard focusable (e.g. row number column), we need to find the first focusable cell.
if (this.grid.canCellBeActive(0, col)) {
cellToFocus = {
row: 0,
cell: col
};
break;
}
}
if (cellToFocus) {
this.grid.setActiveCell(cellToFocus.row, cellToFocus.cell);
}
}
clearTimeout(this._classChangeTimeout);
this._classChangeTimeout = setTimeout(() => {
this._container.classList.add('focused');
@@ -139,14 +121,6 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
this.mapMouseEvent(this._grid.onHeaderClick, this._onHeaderClick);
this.mapMouseEvent(this._grid.onDblClick, this._onDoubleClick);
this._grid.onColumnsResized.subscribe(() => this._onColumnResize.fire());
this._grid.onRendered.subscribe(() => {
if (!this._grid.getActiveCell()) {
this._container.tabIndex = this._data.getLength() > 0 ? 0 : -1;
}
});
this._grid.onActiveCellChanged.subscribe((e, data) => {
this._container.tabIndex = -1;
});
}
public rerenderGrid() {

View File

@@ -9596,9 +9596,9 @@ slice-ansi@^2.0.0, slice-ansi@^2.1.0:
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.34":
version "2.3.34"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/8cecf97e731bbbb012fd37932b8380ea1eab4961"
"slickgrid@github:Microsoft/SlickGrid.ADS#2.3.35":
version "2.3.35"
resolved "https://codeload.github.com/Microsoft/SlickGrid.ADS/tar.gz/f49b033a01a8ce6325ea39972284c004a4f9a86b"
smart-buffer@^4.1.0:
version "4.1.0"