Skip to content

Commit ff60628

Browse files
committed
fix bug when tab on editing cell with navigation
1 parent 174dc19 commit ff60628

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/BootstrapTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ class BootstrapTable extends Component {
518518
}
519519
}
520520

521-
handleNavigateCell = ({ x: offSetX, y: offSetY }) => {
521+
handleNavigateCell = ({ x: offSetX, y: offSetY, lastEditCell }) => {
522522
const { pagination } = this.props;
523523
let { x, y, currPage } = this.state;
524524
x += offSetX;
@@ -560,7 +560,7 @@ class BootstrapTable extends Component {
560560
} else {
561561
y++;
562562
}
563-
x = 0;
563+
x = lastEditCell ? 1 : 0;
564564
} else if (x < 0) {
565565
x = visibleColumnSize - 1;
566566
if (y === 0) {

src/TableBody.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class TableBody extends Component {
195195
);
196196
}
197197

198-
handleCellKeyDown = e => {
198+
handleCellKeyDown = (e, lastEditCell) => {
199199
e.preventDefault();
200200
let offset;
201201
if (e.keyCode === 37) {
@@ -204,6 +204,12 @@ class TableBody extends Component {
204204
offset = { x: 0, y: -1 };
205205
} else if (e.keyCode === 39 || e.keyCode === 9) {
206206
offset = { x: 1, y: 0 };
207+
if (e.keyCode === 9 && lastEditCell) {
208+
offset = {
209+
...offset,
210+
lastEditCell
211+
};
212+
}
207213
} else if (e.keyCode === 40) {
208214
offset = { x: 0, y: 1 };
209215
}
@@ -298,6 +304,9 @@ class TableBody extends Component {
298304
if (columnIndex >= this.props.columns.length) {
299305
rowIndex = rowIndex + 1;
300306
columnIndex = 1;
307+
this.handleCellKeyDown(e, true);
308+
} else {
309+
this.handleCellKeyDown(e);
301310
}
302311
}
303312

0 commit comments

Comments
 (0)