diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-21 02:59:14 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-21 13:01:18 +0200 |
commit | ec00367f3006dfe0389854a5340bf4effcc8452c (patch) | |
tree | 7b97c85dcb431b3a6c8f8c04e5bb2c69197c39f7 /lib | |
parent | c07cf51bebf4dcc90a522e0fc580365ca4ef02ef (diff) | |
download | nextcloud-server-ec00367f3006dfe0389854a5340bf4effcc8452c.tar.gz nextcloud-server-ec00367f3006dfe0389854a5340bf4effcc8452c.zip |
fix: Disable auto-zoom on iOS
When using iOS and focussing an input element the view should not be zoomed.
So if we set a maximum scale iOS will not auto-zoom but still allow users to zoom.
But we can not do this by default as this will disable user zoom on Chrome.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/TemplateLayout.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 7b33f88d4db..272557f5177 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -8,6 +8,7 @@ namespace OC; use bantu\IniGetWrapper\IniGetWrapper; +use OC\AppFramework\Http\Request; use OC\Authentication\Token\IProvider; use OC\Files\FilenameValidator; use OC\Search\SearchQuery; @@ -20,6 +21,7 @@ use OCP\Defaults; use OCP\IConfig; use OCP\IInitialStateService; use OCP\INavigationManager; +use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUserSession; use OCP\L10N\IFactory; @@ -286,6 +288,13 @@ class TemplateLayout extends \OC_Template { } } + $request = \OCP\Server::get(IRequest::class); + if ($request->isUserAgent([Request::USER_AGENT_CLIENT_IOS, Request::USER_AGENT_SAFARI])) { + // Prevent auto zoom with iOS but still allow user zoom + // On chrome (and others) this does not work (will also disable user zoom) + $this->assign('viewport_maximum_scale', '1.0'); + } + $this->assign('initialStates', $this->initialState->getInitialStates()); $this->assign('id-app-content', $renderAs === TemplateResponse::RENDER_AS_USER ? '#app-content' : '#content'); |