问题
无法从 Firefox 上禁用的 matInput 复制文本。这适用于 Chrome 和 Safari。Stackoverflow 上有一些关于此的讨论: 链接 1 链接 2
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 讨论这个问题以了解他们在这个问题上的立场?