Skip to content

Commit ce6f744

Browse files
committed
fix #1394
1 parent acf583f commit ce6f744

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/BootstrapTable.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class BootstrapTable extends Component {
216216
replace = replace || this.props.replace;
217217

218218
if (!nextProps.data) {
219-
return;
219+
return;
220220
}
221221
this.store.setData(nextProps.data.slice());
222222

@@ -464,7 +464,8 @@ class BootstrapTable extends Component {
464464
keyBoardNav={ this.props.keyBoardNav }
465465
onNavigateCell={ this.handleNavigateCell }
466466
x={ this.state.x }
467-
y={ this.state.y } />
467+
y={ this.state.y }
468+
withoutTabIndex={ this.props.withoutTabIndex } />
468469
</div>
469470
{ tableFilter }
470471
{ showPaginationOnBottom ? pagination : null }
@@ -1440,6 +1441,7 @@ BootstrapTable.propTypes = {
14401441
condensed: PropTypes.bool,
14411442
pagination: PropTypes.bool,
14421443
printable: PropTypes.bool,
1444+
withoutTabIndex: PropTypes.bool,
14431445
keyBoardNav: PropTypes.oneOfType([ PropTypes.bool, PropTypes.object ]),
14441446
searchPlaceholder: PropTypes.string,
14451447
selectRow: PropTypes.shape({
@@ -1605,6 +1607,7 @@ BootstrapTable.defaultProps = {
16051607
condensed: false,
16061608
pagination: false,
16071609
printable: false,
1610+
withoutTabIndex: false,
16081611
keyBoardNav: false,
16091612
searchPlaceholder: undefined,
16101613
selectRow: {

src/TableBody.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class TableBody extends Component {
127127
keyBoardNav={ enableKeyBoardNav }
128128
onKeyDown={ this.handleCellKeyDown }
129129
customNavStyle={ customNavStyle }
130-
row={ data }>
130+
row={ data }
131+
withoutTabIndex={ this.props.withoutTabIndex }>
131132
{ columnChild }
132133
</TableColumn>
133134
);
@@ -526,6 +527,7 @@ TableBody.propTypes = {
526527
keyBoardNav: PropTypes.oneOfType([ PropTypes.bool, PropTypes.object ]),
527528
x: PropTypes.number,
528529
y: PropTypes.number,
529-
onNavigateCell: PropTypes.func
530+
onNavigateCell: PropTypes.func,
531+
withoutTabIndex: PropTypes.bool
530532
};
531533
export default TableBody;

src/TableColumn.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class TableColumn extends Component {
108108
keyBoardNav,
109109
tabIndex,
110110
customNavStyle,
111+
withoutTabIndex,
111112
row
112113
} = this.props;
113114

@@ -147,8 +148,11 @@ class TableColumn extends Component {
147148
className = `${className} default-focus-cell`;
148149
}
149150
}
151+
152+
const attr = {};
153+
if (!withoutTabIndex) attr.tabIndex = tabIndex;
150154
return (
151-
<td tabIndex={ tabIndex } style={ tdStyle }
155+
<td { ...attr } style={ tdStyle }
152156
title={ columnTitle }
153157
className={ className }
154158
{ ...opts } { ...attrs }>
@@ -170,13 +174,15 @@ TableColumn.propTypes = {
170174
isFocus: PropTypes.bool,
171175
onKeyDown: PropTypes.func,
172176
tabIndex: PropTypes.string,
177+
withoutTabIndex: PropTypes.bool,
173178
keyBoardNav: PropTypes.oneOfType([ PropTypes.bool, PropTypes.object ]),
174179
customNavStyle: PropTypes.oneOfType([ PropTypes.func, PropTypes.object ]),
175180
row: PropTypes.any /* only used on custom styling for navigation */
176181
};
177182

178183
TableColumn.defaultProps = {
179184
dataAlign: 'left',
185+
withoutTabIndex: false,
180186
hidden: false,
181187
className: '',
182188
isFocus: false,

0 commit comments

Comments
 (0)