Skip to content

Drag and Drop - Can't select text in an input without moving all item #14117

Closed
@Samoulou

Description

@Samoulou

Bug, feature request, or proposal:

I'm using the new cdkDrag in a mat-list. It seems it can't handle text selection in an input.
test

What is the expected behavior?

I should be able to select the text in my input without my mat-list-item dragging

What is the current behavior?

When I try to select text in my input all my component is dragging away

What are the steps to reproduce?

<mat-list cdkDropList fxFlex role="list" (cdkDropListDropped)="drop($event)">
  <mat-list-item (mouseover)="listitem=i" (mouseleave)="listitem=null;" *ngFor="let productionInformation of productionInformationItems.controls; let i=index" [formGroupName]="i" fxLayout="column" cdkDrag>
    <mat-form-field fxFlex *ngIf="i > sizeBeforeSave-1 || isEdition == i || !isLabel; else notShow;">
      <input matInput formControlName="value" />
    </mat-form-field>
    <ng-template #notShow>
      <mat-label fxFlex>{{productionInformation.get('value').value}}</mat-label>
    </ng-template>
    <button mat-icon-button *ngIf="listitem == i && i < sizeBeforeSave && isEdition!=i && isLabel" (click)="editProductionInformationValue(i)">
      <mat-icon>edit</mat-icon>
    </button>
    <button mat-icon-button *ngIf="listitem == i && !noDelete" (click)="deleteProductionInformationValue(i)">
      <mat-icon>delete</mat-icon>
    </button>
  </mat-list-item>
</mat-list>

What is the use-case or motivation for changing an existing behavior?

Correcting a behaviour that is not working well

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/cdk": "7.0.1", "@angular/material": "7.0.1", "@angular/core": "7.0.1", "typescript": "3.1.3"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions