ipad ios 5 上 iframe 内的文本输入或 textarea 元素不支持事件

发布于 2024-12-18 15:15:46 字数 432 浏览 3 评论 0原文

我在 iPad 上测试的网站上的 iframe 中有一个表单。触摸事件似乎不适用于“文本”类型或文本区域元素的输入。滑动或触摸对这些区域没有任何作用,键盘也不会弹出。我可以很好地与组合框(选择)元素进行交互。还有其他人遇到这个问题吗?

我在 iPad iOS 4.3 上没有任何问题,仅在 iPad iOS 5 上没有问题。标记和样式非常标准,但如果没有其他人遇到此问题,我可以发布代码。我能想到的唯一独特元素是所有标记都是使用 jQuery tmpl 动态加载的。

我只在网上看到有关文本区域滚动的文档,但这似乎是一个单独的问题。

更正*

我只是直接点击页面(在 iframe 之外),但仍然遇到同样的问题。那么以前有人见过这种行为吗?是因为奇怪的 CSS 样式吗? Z 索引?

I have a form within an iframe on a website that I am testing on iPad. It seems that the touch events do not work on the inputs with type "text" or textarea elements. Swiping or touching does nothing on those areas and the keyboard does not pop up. The combo box (select) elements I can interact with just fine. Is anyone else having this problem?

I have no issues on iPad iOS 4.3 only on iPad iOS 5. The markup and styling are pretty standard, but if no one else is experiencing this issue I can post the code. The only unique element that I can think of is that all of the markup is loaded dynamically using jQuery tmpl.

I have only seen documentation online regarding scrolling of textareas but this seems to be a separate issue.

Correction *

I just hit the page directly (outside of the iframe) and am still having the same problem. So has anyone seen this behavior before? Is it due to strange CSS styling? Z-indexing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

春庭雪 2024-12-25 15:15:46

好的,明白了!所以我注意到点击事件正在注册,但默认的拖动行为没有注册。我还记得我已经实现了一个用于可拖动行为的 jquery ui 扩展,该扩展将触摸事件挂钩到其单击和鼠标移动事件处理中。这就是罪魁祸首。我删除了该扩展并添加了这个:github.com/furf/jquery-ui-touch-punch 这适用于 iOS 4.3 和 iOS 5.1

OKAY GOT IT! So I noticed that click events were registering but default drag behavior was not. I also remembered that I had implemented a jquery ui extension for draggable behavior that hooked touch events into their click and mousemove event handling. That was the culprit. I removed that extension and added this instead : github.com/furf/jquery-ui-touch-punch This works on both iOS 4.3 and iOS 5.1

长途伴 2024-12-25 15:15:46

我想这一定是 iOS 中的一个错误......

或者你可以发布一个链接到你所做的吗?
我可以在我的 iPod Touch 上测试它...

I guess that has to be a bug in iOS...

Or could you post a link to what you have made?
I could test it on my iPod Touch...

他夏了夏天 2024-12-25 15:15:46

我已经遇到这个问题好几天了,通过谷歌搜索,大多数互联网也有这个问题。但所有帖子都没有给出答案。这是对我有用的解决方案。它基于 https://gist.github.com/tamarasaurus/dcf2d0331043586421f3。希望这能帮助人们将来,或者至少为他们指明正确的方向。

document.addEventListener('keydown', function(e) {
    window.focus();
});

document.addEventListener('touchend', function(e) {
    window.focus();
});

I've had this problem for days now, and from googling around, most of the internet has too. But none of the posts contained an answer. This is the solution that worked for me. It's based on https://gist.github.com/tamarasaurus/dcf2d0331043586421f3. Hopefully this will help people in the future, or at least point them in the right direction.

document.addEventListener('keydown', function(e) {
    window.focus();
});

document.addEventListener('touchend', function(e) {
    window.focus();
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文