@@ -55,6 +55,9 @@ const INNER_STYLE = {
5555 minWidth : '100%'
5656} ;
5757
58+ const columnSelector = ( column_id : string ) =>
59+ `[data-dash-column="${ CSS . escape ( column_id ) } "]:not(.phantom-cell)` ;
60+
5861export default class ControlledTable extends PureComponent < ControlledTableProps > {
5962 private readonly menuRef = React . createRef < HTMLDivElement > ( ) ;
6063 private readonly stylesheet : Stylesheet = new Stylesheet (
@@ -176,12 +179,9 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
176179 ( active . column_id !== active_cell ?. column_id ||
177180 active . row !== active_cell ?. row )
178181 ) {
182+ const { column_id, row} = active_cell ;
179183 const target = this . $el . querySelector (
180- `td[data-dash-row="${
181- active_cell . row
182- } "][data-dash-column="${ CSS . escape (
183- active_cell . column_id
184- ) } "]:not(.phantom-cell)`
184+ `td[data-dash-row="${ row } "]${ columnSelector ( column_id ) } `
185185 ) as HTMLElement ;
186186 if ( target ) {
187187 target . focus ( ) ;
@@ -1170,19 +1170,11 @@ export default class ControlledTable extends PureComponent<ControlledTableProps>
11701170 const { table, tooltip : t } = this . refs as { [ key : string ] : any } ;
11711171
11721172 if ( t ) {
1173- const cell = header
1174- ? table . querySelector (
1175- `tr:nth-of-type(${
1176- row + 1
1177- } ) th[data-dash-column="${ CSS . escape (
1178- id
1179- ) } "]:not(.phantom-cell)`
1180- )
1181- : table . querySelector (
1182- `td[data-dash-column="${ CSS . escape (
1183- id
1184- ) } "][data-dash-row="${ row } "]:not(.phantom-cell)`
1185- ) ;
1173+ const cell = table . querySelector (
1174+ header
1175+ ? `tr:nth-of-type(${ row + 1 } ) th${ columnSelector ( id ) } `
1176+ : `td[data-dash-row="${ row } "]${ columnSelector ( id ) } `
1177+ ) ;
11861178
11871179 ( this . refs . tooltip as TableTooltip ) . updateBounds ( cell ) ;
11881180 }
0 commit comments