@@ -589,10 +589,6 @@ export const GridMixin = (superClass) =>
589589 } ) ;
590590 }
591591
592- if ( column && column . _onCellKeyDown ) {
593- cell . addEventListener ( 'keydown' , column . _onCellKeyDown . bind ( column ) ) ;
594- }
595-
596592 const slot = document . createElement ( 'slot' ) ;
597593 slot . setAttribute ( 'name' , slotName ) ;
598594
@@ -681,6 +677,9 @@ export const GridMixin = (superClass) =>
681677 cell = column . _cells . find ( ( cell ) => cell . _vacant ) ;
682678 if ( ! cell ) {
683679 cell = this . _createCell ( 'td' , column ) ;
680+ if ( column . _onCellKeyDown ) {
681+ cell . addEventListener ( 'keydown' , column . _onCellKeyDown . bind ( column ) ) ;
682+ }
684683 column . _cells . push ( cell ) ;
685684 }
686685 cell . setAttribute ( 'part' , 'cell body-cell' ) ;
@@ -724,7 +723,13 @@ export const GridMixin = (superClass) =>
724723 // Header & footer
725724 const tagName = section === 'header' ? 'th' : 'td' ;
726725 if ( isColumnRow || column . localName === 'vaadin-grid-column-group' ) {
727- cell = column [ `_${ section } Cell` ] || this . _createCell ( tagName , column ) ;
726+ cell = column [ `_${ section } Cell` ] ;
727+ if ( ! cell ) {
728+ cell = this . _createCell ( tagName ) ;
729+ if ( column . _onCellKeyDown ) {
730+ cell . addEventListener ( 'keydown' , column . _onCellKeyDown . bind ( column ) ) ;
731+ }
732+ }
728733 cell . _column = column ;
729734 row . appendChild ( cell ) ;
730735 column [ `_${ section } Cell` ] = cell ;
0 commit comments