@@ -3779,29 +3779,21 @@ export abstract class IgxGridBaseDirective implements GridType,
37793779 */
37803780 public _setupListeners ( ) {
37813781 const destructor = takeUntil < any > ( this . destroy$ ) ;
3782- fromEvent ( this . nativeElement , 'focusout' ) . pipe ( filter ( ( ) => ! ! this . navigation . activeNode ) , destructor ) . subscribe ( ( event : FocusEvent ) => {
3783- const activeNode = this . navigation . activeNode ;
3784- if ( this . crudService . cell || ! activeNode ) {
3785- return ;
3786- }
3787- const nextFocused = event . relatedTarget as Node ;
3788- const activeElement = ( nextFocused || this . document . activeElement ) as Node ;
3789- const focusWithin = ! ! activeElement && this . nativeElement . contains ( activeElement ) ;
3790- const allowClear = ! ( this . rowEditable && this . crudService . rowEditingBlocked && this . crudService . rowInEditMode ) ;
3791-
3792- if ( ! focusWithin && allowClear ) {
3793- this . clearActiveNode ( ) ;
3794- return ;
3795- }
3796-
3797- if ( ( ( event . target === this . tbody . nativeElement && activeNode . row >= 0 &&
3798- activeNode . row < this . dataView . length )
3799- || ( event . target === this . theadRow . nativeElement && activeNode . row === - 1 )
3800- || ( event . target === this . tfoot . nativeElement && activeNode . row === this . dataView . length ) ) &&
3801- allowClear ) {
3802- this . clearActiveNode ( ) ;
3803- }
3804- } ) ;
3782+ fromEvent ( this . document , 'focusin' )
3783+ . pipe ( filter ( ( ) => ! ! this . navigation . activeNode ) , destructor )
3784+ . subscribe ( ( event : FocusEvent ) => {
3785+ if ( this . crudService . cell || ! this . navigation . activeNode ) {
3786+ return ;
3787+ }
3788+ if ( this . rowEditable && this . crudService . rowEditingBlocked && this . crudService . rowInEditMode ) {
3789+ return ;
3790+ }
3791+ const target = event . target as Node ;
3792+ if ( target && this . nativeElement . contains ( target ) ) {
3793+ return ;
3794+ }
3795+ Promise . resolve ( ) . then ( ( ) => this . clearActiveNode ( ) ) ;
3796+ } ) ;
38053797 this . rowAddedNotifier . pipe ( destructor ) . subscribe ( args => this . refreshGridState ( args ) ) ;
38063798 this . rowDeletedNotifier . pipe ( destructor ) . subscribe ( args => {
38073799 this . summaryService . deleteOperation = true ;
0 commit comments