【问题标题】:Input of type password is blocking backspace key only on Safari输入密码类型仅在 Safari 上阻止退格键
【发布时间】:2020-09-26 09:30:18
【问题描述】:

我在输入密码类型时遇到问题,这会阻止用户按退格键,因此他无法删除字符。奇怪的是,它还阻止了上面的电子邮件输入。 但是,当我将密码输入的类型更改为文本时,一切正常。

我正在使用:

  • Angular 8.2.14
  • 角材料 8.2.3
  • Safari 13.1

npx browserslist 命令输出 safari 13,safari 12.1 for the projet。

这是代码的样子:

<mat-card *ngIf="!loading">
  <mat-card-title>
    {{"LOGIN" | translate}}
  </mat-card-title>
  <mat-card-content>
    <form (ngSubmit)="valid()">
      <mat-form-field>
        <input matInput [placeholder]="'EMAIL_ADDRESS' | translate" [(ngModel)]="email" name="email"/>
      </mat-form-field>
      <mat-form-field>
        <input type="text" matInput [placeholder]="'PASSWORD' | translate" [(ngModel)]="password" name="password"/>
      </mat-form-field>
      <div>
        <mat-checkbox [(ngModel)]="rememberMe" name="rememberMe">{{'REMEMBER_ME' | translate}}</mat-checkbox>
      </div>
      <div>
        <a [routerLink]="'/forget'">{{ 'PASSWORD_FORGET' | translate }}</a>
      </div>
      <button class="margined" mat-raised-button color="primary"> {{"SUBMIT" | translate}}</button>
    </form>
  </mat-card-content>
</mat-card>

我已尝试删除所有与 Angular Material 库相关的内容,但似乎无法解决问题。

【问题讨论】:

  • 尝试删除时是否有任何错误?如果你删除翻译管道还是同样的问题?
  • @pc_coder 尝试删除时没有错误,当我只是擦除占位符及其内容时,我仍然遇到问题。

标签: javascript html angular safari angular-material


【解决方案1】:

答案是删除这一小段css

input { -webkit-user-select: all!important; }

现在一切正常。很抱歉给您带来不便,这是我的错。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-04
    • 2018-07-26
    • 2019-04-23
    • 2020-03-25
    • 1970-01-01
    • 1970-01-01
    • 2016-12-28
    • 2015-05-24
    相关资源
    最近更新 更多