在 iOS 11.3 Safari 上有没有一种非hacky 的方法来防止捏合缩放? [英] Is there a non-hacky way to prevent pinch zoom on iOS 11.3 Safari?

查看:26
本文介绍了在 iOS 11.3 Safari 上有没有一种非hacky 的方法来防止捏合缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的想禁用捏合缩放我的网页(iframe)并使用手指捏合事件进行另一个自定义交互.因此,虽然 Apple 在他们的文档说它支持以下子句:

I really want to disable pinch to zoom on my webpages (iframes) and use finger pinching events for another custom interaction. So while Apple in their documentation says that it supports the following clause:

<meta name="viewport" content="width=device-width, user-scalable=no" />

...实际上,他们在 iOS 和 iPadOS 上的 Safari 浏览器并不尊重它.

…in practice their Safari browser on iOS and iPadOS does not honor it.

防止视口缩放的能力对于网络游戏体验以及靠近按钮、输入框和滑入/滑出类型界面的紧密用户体验通常很重要(想想 Tinder).即使在视频上也不需要缩放,但也许 pinchzoom 可以在电子阅读器上保持良好的默认设置?

The ability to prevent viewport zooming is generally important for the experience of gaming on the web and for tight user experience near buttons, input boxes and slide-in/slide-out type of interfaces (think Tinder). Even on videos pinch-zooming is not required, but maybe pinchzoom can remain a good default on ereaders?

这里值得一提的是,iOS Safari 上也有一个精简的reader 模式,可提供具有所需辅助功能的整洁阅读.

It is worth mentioning here that there is a stripped down reader mode on iOS Safari too, that provides for uncluttered reading with desired accessibility features.

恕我直言,将针对低视力读者的可访问性指南应用于网络上的每个其他用例是非常严厉的.虽然可以使用 passive 事件侦听器禁用 pinchzoom,但为了卫生起见,问题是:有没有一种非hacky 的方法来做到这一点?

IMHO, applying accessibility guideline aimed at low vision readers on every other use-case on the web is super draconian. While it is possible to disable pinchzoom using a passive event listener, but for the sake of hygiene, the question is: Is there a non-hacky way of doing it?

在与 W3C/WCAG 团队最近的讨论中澄清(强调我的)可访问性指南仅指定......

In a recent discussion with W3C/WCAG team it was clarified (emphasis mine) that the accessibility guidelines specify only…

不应该编写规范中的一致性要求自 2016 年以来,arronei/html@877b59c.这是作者的一致性仅要求,不禁止使用,但确实要求作者认真考虑用户缩放能力的缩减.什么苹果在 safari 中所做的事情超出了这个问题的范围,因为它确实如此不需要任何浏览器实现者.

a SHOULD NOT author conformance requirement that has been in the spec since 2016 arronei/html@877b59c. It is an author conformance requirement only, that does not forbid the use but does ask authors to consider seriously the curtailment of user's ability to zoom. What apple have done in safari is beyond the scope of this issue as it does not require anything of browser implementers.

随着 iOS Safari 最近的变化,Apple 似乎已经将可访问性指南倾向于 CANNOT 作者一致性,原因是他们最清楚的 (;-)).重要的是在此强调规范和实现之间的差异以供记录.

With the recent changes on iOS Safari, Apple appears to have bent the accessibility guidelines towards a CANNOT author conformance for reasons best (;-)) known to them. It is important that this difference between the spec and implementation be highlighted here for the record.

在与 Apple iOS Safari 团队讨论后,webkit 已针对此一致性问题提交了一个错误 这里.

Following discussions with the Apple iOS Safari team a bug was filed with webkit for this conformance issue here.

推荐答案

虽然没有一种非hacky 的方法来防止pinchzoom,但有一个hack 仍然适用于iOS 11.3 Safari.最起码到现在.请参阅 inobounce,它可以一次性处理橡皮筋行为和缩放.

While there isn't a non-hacky way to prevent pinchzoom, there is a hack that works on iOS 11.3 Safari still. At least for now. See inobounce that handles both rubber band behavior and pinchzoom in one fell sweep.

这篇关于在 iOS 11.3 Safari 上有没有一种非hacky 的方法来防止捏合缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆