如何在固定模态错误中修复 iOS 11 输入元素

2023-06-21前端开发问题
2

本文介绍了如何在固定模态错误中修复 iOS 11 输入元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

新发布的 iOS 11 中 HTML 输入中的一个错误正在给在固定容器中具有输入元素的网站带来问题.这正是正在发生的事情以及一些可能的解决方法.

A bug in HTML inputs in the newly released iOS 11 is creating problems for websites that have input elements in fixed containers. Here is exactly what is happening and some possible workarounds.

如果您有一个固定容器,并且它离屏幕底部足够近,迫使浏览器滚动为键盘腾出空间,则光标将放在文本输入之外.这对我们来说是一个关键问题,因为我们的核心功能之一依赖于用户通过固定模式对话框进行的输入.

If you have an in an fixed container and it is close enough to the bottom of the screen forcing the browser to scroll to make room for the keyboard, the cursor is put outside of the text input. This was a critical problem for us since one of our core functionalities relies on the user input through a fixed modal dialog.

这对我们来说是一个关键问题,因为我们的核心功能之一依赖于用户通过固定模式对话框进行的输入.

This was a critical problem for us since one of our core functionalities relies on the user input through a fixed modal dialog.

推荐答案

目前没有完美的解决方案.两个临时选项:

For now there is no perfect fix for it. Two temporary options:

  1. 将对话框/模态更改为 position: absolute(不推荐)
  2. 尝试在模式/对话框打开时移除背景滚动,并在对话框关闭时恢复它.

选项 2 的详细信息:例如,您可以在对话框打开时将根 div(或具有滚动条的任何内容)设置为 overflowY='hidden',然后将其改回 overflowY='' 对话框关闭时.(缺点:打开对话框/模式时浏览器会滚动到顶部)

Detail for option 2: For example, you can set your root div (or whatever that has a scrollbar) as overflowY='hidden' when dialog opens, and change it back overflowY='' when dialog closes. (Drawback: browser will be scrolled to top when you open dialog/modal)

注意:

  1. 请记住在触发修复时检测操作系统/浏览器,否则您可能会在 IE 中遇到问题.
  2. 关注此线程,获取有关此问题的最新更新.李>
  1. Do remember to detect OS/browser when trigger fixes, otherwise you will probably encounter problem in IE.
  2. Follow this thread to get the newest update about this issue.

这篇关于如何在固定模态错误中修复 iOS 11 输入元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

layui中表单会自动刷新的问题
layui中表单会自动刷新的问题,因为用到layui的表单,遇到了刷新的问题所以记录一下: script layui.use(['jquery','form','layer'], function(){ var $ = layui.jquery, layer=layui.layer, form = layui.form; form.on('submit(tijiao)', function(data){ a...
2024-10-23 前端开发问题
262

jQuery怎么动态向页面添加代码?
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href...
2024-10-18 前端开发问题
125

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437

ExecJS::ProgramError: SyntaxError: 保留字“function"
ExecJS::ProgramError: SyntaxError: Reserved word quot;functionquot;(ExecJS::ProgramError: SyntaxError: 保留字“function)...
2024-04-20 前端开发问题
13