@@ -3709,29 +3709,21 @@ export abstract class IgxGridBaseDirective implements GridType,
37093709 */
37103710 public _setupListeners ( ) {
37113711 const destructor = takeUntil < any > ( this . destroy$ ) ;
3712- fromEvent ( this . nativeElement , 'focusout' ) . pipe ( filter ( ( ) => ! ! this . navigation . activeNode ) , destructor ) . subscribe ( ( event : FocusEvent ) => {
3713- const activeNode = this . navigation . activeNode ;
3714- if ( this . crudService . cell || ! activeNode ) {
3715- return ;
3716- }
3717- const nextFocused = event . relatedTarget as Node ;
3718- const activeElement = ( nextFocused || this . document . activeElement ) as Node ;
3719- const focusWithin = ! ! activeElement && this . nativeElement . contains ( activeElement ) ;
3720- const allowClear = ! ( this . rowEditable && this . crudService . rowEditingBlocked && this . crudService . rowInEditMode ) ;
3721-
3722- if ( ! focusWithin && allowClear ) {
3723- this . clearActiveNode ( ) ;
3724- return ;
3725- }
3726-
3727- if ( ( ( event . target === this . tbody . nativeElement && activeNode . row >= 0 &&
3728- activeNode . row < this . dataView . length )
3729- || ( event . target === this . theadRow . nativeElement && activeNode . row === - 1 )
3730- || ( event . target === this . tfoot . nativeElement && activeNode . row === this . dataView . length ) ) &&
3731- allowClear ) {
3732- this . clearActiveNode ( ) ;
3733- }
3734- } ) ;
3712+ fromEvent ( this . document , 'focusin' )
3713+ . pipe ( filter ( ( ) => ! ! this . navigation . activeNode ) , destructor )
3714+ . subscribe ( ( event : FocusEvent ) => {
3715+ if ( this . crudService . cell || ! this . navigation . activeNode ) {
3716+ return ;
3717+ }
3718+ if ( this . rowEditable && this . crudService . rowEditingBlocked && this . crudService . rowInEditMode ) {
3719+ return ;
3720+ }
3721+ const target = event . target as Node ;
3722+ if ( target && this . nativeElement . contains ( target ) ) {
3723+ return ;
3724+ }
3725+ Promise . resolve ( ) . then ( ( ) => this . clearActiveNode ( ) ) ;
3726+ } ) ;
37353727 this . rowAddedNotifier . pipe ( destructor ) . subscribe ( args => this . refreshGridState ( args ) ) ;
37363728 this . rowDeletedNotifier . pipe ( destructor ) . subscribe ( args => {
37373729 this . summaryService . deleteOperation = true ;
0 commit comments