-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from letehaha/fix/small-ui-fixes
Fix small UI issues
- Loading branch information
Showing
5 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./color-theme"; | ||
export * from "./meta-viewport-max-scale"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export const patchMetaViewportMaxScaleForiOS = () => { | ||
const addMaximumScaleToMetaViewport = () => { | ||
const el = document.querySelector("meta[name=viewport]"); | ||
|
||
if (el !== null) { | ||
let content = el.getAttribute("content"); | ||
const re = /maximum-scale=[0-9.]+/g; | ||
|
||
if (re.test(content)) { | ||
content = content.replace(re, "maximum-scale=1.0"); | ||
} else { | ||
content = [content, "maximum-scale=1.0"].join(", "); | ||
} | ||
|
||
el.setAttribute("content", content); | ||
} | ||
}; | ||
|
||
const disableIosTextFieldZoom = addMaximumScaleToMetaViewport; | ||
|
||
// https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885 | ||
const checkIsIOS = () => /iPad|iPhone|iPod/.test(navigator.userAgent); | ||
|
||
if (checkIsIOS()) { | ||
disableIosTextFieldZoom(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters