无法从Firefox上禁用的matInput复制文本

时间:2019-09-24 05:02:28

标签: firefox angular-material copy disabled-input mat-input

问题

无法从Firefox上禁用的matInput复制文本。这适用于Chrome和Safari。关于Stackoverflow有一些讨论: Link 1 Link 2

Stackblitz

HTML

   <form [formGroup]="customerContactFormGroup">
      <mat-form-field>
        <input matInput placeholder="Copy below text in Firefox" formControlName="customerName">
      </mat-form-field>
    </form>

TS

export class AppComponent implements OnInit{
  customerContactFormGroup: FormGroup;

  constructor(private formBuilder: FormBuilder) {
    this.customerContactFormGroup = this.formBuilder.group({
      customerName: ['Some Text to Copy', Validators.required]
    });
  }

  ngOnInit(){
    this.customerContactFormGroup.get('customerName').disable();
  }
}

我正在使用Angular的 formgroup.disable()方法。根据Mozilla,在readonly属性和Disabled属性之间有明确的界限。

复制文本有几种解决方法,有人在没有这些解决方法的情况下解决了该问题,还是与Angular Material Team讨论了此事,以了解他们在此问题上的立场?

0 个答案:

没有答案