diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index cbab8bfd3b0..638733349aa 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.5.6-beta05 + 9.5.6 diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.js b/src/BootstrapBlazor/Components/Table/Table.razor.js index 6be8c44c291..0998ac3afe6 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.js +++ b/src/BootstrapBlazor/Components/Table/Table.razor.js @@ -389,15 +389,19 @@ const setExcelKeyboardListener = table => { const setFocus = target => { const handler = setTimeout(function () { clearTimeout(handler); - target.focus(); - target.select(); + if (target.focus) { + target.focus(); + } + if (target.select) { + target.select(); + } }, 10); } const activeCell = (cells, index) => { let ret = false; const td = cells[index]; - const target = td.querySelector('input.form-control:not([readonly])'); + const target = td.querySelector('.form-control:not([readonly])'); if (target) { setFocus(target); ret = true; @@ -425,22 +429,30 @@ const setExcelKeyboardListener = table => { } } else if (keyCode === KeyCodes.UP_ARROW) { - cells = tr.previousElementSibling && tr.previousElementSibling.children; - if (cells) { - while (index < cells.length) { + let nextRow = tr.previousElementSibling; + while (nextRow) { + cells = nextRow.children; + if (cells) { if (activeCell(cells, index)) { break; } + else { + nextRow = nextRow.previousElementSibling; + } } } } else if (keyCode === KeyCodes.DOWN_ARROW) { - cells = tr.nextElementSibling && tr.nextElementSibling.children; - if (cells) { - while (index < cells.length) { + let nextRow = tr.nextElementSibling; + while (nextRow) { + cells = nextRow.children; + if (cells) { if (activeCell(cells, index)) { break; } + else { + nextRow = nextRow.nextElementSibling; + } } } }