diff --git a/projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts b/projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts index 4e668b4ff914..4f7ddd8d1fc3 100644 --- a/projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts +++ b/projects/addon-mobile/directives/dropdown-mobile/dropdown-mobile.component.ts @@ -12,6 +12,8 @@ import {TuiKeyboardService} from '@taiga-ui/addon-mobile/services'; import { TuiActiveZoneDirective, tuiGetNativeFocused, + tuiIsElement, + tuiIsNodeIn, tuiPx, TuiSwipe, } from '@taiga-ui/cdk'; @@ -73,7 +75,14 @@ export class TuiDropdownMobileComponent implements OnDestroy, AfterViewInit { } onClick(event: MouseEvent): void { - if (!this.el.nativeElement.contains(event.target as Node)) { + if ( + !this.el.nativeElement.contains(event.target as Node) && + // TODO: find a better way to check if the click is inside interactive element in textfield + !( + tuiIsNodeIn(event.target as Node, 'tui-svg') || + (tuiIsElement(event.target) && event.target.tagName === 'button') + ) + ) { event.stopPropagation(); } } diff --git a/projects/demo/src/modules/directives/dropdown/examples/5/index.html b/projects/demo/src/modules/directives/dropdown/examples/5/index.html index 5416838ecc20..eadea627b39b 100644 --- a/projects/demo/src/modules/directives/dropdown/examples/5/index.html +++ b/projects/demo/src/modules/directives/dropdown/examples/5/index.html @@ -1,5 +1,6 @@ Country @@ -28,6 +29,7 @@ tuiDropdownMobile class="tui-space_vertical-4" [stringify]="stringify" + [tuiTextfieldCleaner]="true" [(ngModel)]="selected" [(tuiDropdownOpen)]="open" >