【问题标题】:Can't type in input field using Microsoft Edge and Safari无法使用 Microsoft Edge 和 Safari 在输入字段中键入
【发布时间】:2018-09-11 20:02:19
【问题描述】:

我有一个使用一些引导程序的 Angular 应用程序,并且有一个看起来像这样的文本输入框

   <div class="form-group"> <!-- Name question on the form  -->
     <div class="row">
       <div class="col-12">
         <label>
           Under what name do you want to save this form?
         </label>
       </div>
     </div>
     <div class="input-group">
       <input class="form-control" type="text" [(ngModel)]="cons.name" 
         [ngModelOptions]="{standalone: true}"
         mdTooltipPosition="right"
        autofocus/>
    </div>
  </div>

当我在 Chrome 中使用该应用程序时,输入框工作正常,但在 Microsoft Edge 和 Safari 上,它不允许我在输入框中输入内容。这可能是什么原因造成的?

【问题讨论】:

  • 为 jsfiddle 或 plunker 提供一个可用的示例将帮助人们更快地回答您的问题

标签: html angular bootstrap-4


【解决方案1】:

我不确定你有什么样式,但我遇到了同样的问题,这是由于这条规则:

* {
  user-select: none;
}

我添加的原因是我的 UI 鼓励双击某些元素,结果选择文本时看起来很糟糕。

无论如何:删除此规则修复了“无法在 Edge 中输入文本”问题(我手边没有带 Safari 的设备,因此无法对该浏览器发表评论)。我也在尝试以下规则:

*:not(input) {
  user-select: none;
}

不确定它是否适用于我想要的一切,但可能非常适合您的情况。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-27
    • 1970-01-01
    • 2015-12-27
    相关资源
    最近更新 更多