【问题标题】:Cannot write into input field on safari无法写入 Safari 上的输入字段
【发布时间】:2018-04-17 23:38:01
【问题描述】:

我有一个无法在我的 Iphone 上选择的输入字段。我可以点击输入,但它没有聚焦。出现要写的键盘,但是当我在其中写一些东西时,什么也没有发生。因此我无法填写输入字段。 我的 CSS 中是否缺少某些内容?

<div class="container" v-if="user === null">
        <div class="input">
            <input type="text" v-model="username" placeholder="E-Mail">
        </div>
        <div class="input">
            <input type="password" @keyup.enter="authenticate" v-model="password" placeholder="Passwort">
        </div>
        <div class="buttons">
            <button @click="authenticate">Log In</button>
        </div>
    </div>

【问题讨论】:

标签: ios vue.js nuxt.js


【解决方案1】:

我的网站出错了。我使用的模板带有以下规则的 style.css

* {
  user-select: none;
  -khtml-user-select: none;
  -o-user-select: none;
  -moz-user-select: -moz-none;
  -webkit-user-select: none;
}

我必须为 safari 添加以下内容:

input, input:before, input:after {
  -webkit-user-select: initial;
  -khtml-user-select: initial;
  -moz-user-select: initial;
  -ms-user-select: initial;
  user-select: initial;
}

【讨论】:

  • 这救了我!谢谢你。我很困惑,因为所有其他浏览器在应用用户选择的情况下表现正常。
【解决方案2】:

尝试将您的input 嵌套在form 中。 这对于验证和可访问性更好,并且也可以解决您的问题。

您的登录按钮也应该是submit 类型。请参阅该链接: https://www.w3schools.com/html/html_forms.asp

【讨论】:

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