Skip to content
Snippets Groups Projects
Commit 361fbc68 authored by Greg Fodor's avatar Greg Fodor
Browse files

Fix layout on iOS, prevent zoom on iOS 10+, fix input to use tel instead of...

Fix layout on iOS, prevent zoom on iOS 10+, fix input to use tel instead of number for leading zeros
parent 7c576218
No related branches found
No related tags found
No related merge requests found
...@@ -108,6 +108,7 @@ a { ...@@ -108,6 +108,7 @@ a {
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr 1fr;
text-align: center;
} }
:local(.keypad-button) { :local(.keypad-button) {
...@@ -170,7 +171,7 @@ a { ...@@ -170,7 +171,7 @@ a {
margin: 0; margin: 0;
font-size: 64pt; font-size: 64pt;
border: 0; border: 0;
width: 225px; width: 295px;
letter-spacing: 0.08em; letter-spacing: 0.08em;
text-align: center; text-align: center;
} }
......
...@@ -69,6 +69,7 @@ import UIRoot from "./react-components/ui-root"; ...@@ -69,6 +69,7 @@ import UIRoot from "./react-components/ui-root";
import HubChannel from "./utils/hub-channel"; import HubChannel from "./utils/hub-channel";
import LinkChannel from "./utils/link-channel"; import LinkChannel from "./utils/link-channel";
import { connectToReticulum } from "./utils/phoenix-utils"; import { connectToReticulum } from "./utils/phoenix-utils";
import { disableiOSZoom } from "./utils/disable-ios-zoom";
import "./systems/personal-space-bubble"; import "./systems/personal-space-bubble";
import "./systems/app-mode"; import "./systems/app-mode";
...@@ -133,6 +134,8 @@ if (!isBotMode) { ...@@ -133,6 +134,8 @@ if (!isBotMode) {
registerTelemetry(); registerTelemetry();
} }
disableiOSZoom();
AFRAME.registerInputBehaviour("trackpad_dpad4", trackpad_dpad4); AFRAME.registerInputBehaviour("trackpad_dpad4", trackpad_dpad4);
AFRAME.registerInputBehaviour("joystick_dpad4", joystick_dpad4); AFRAME.registerInputBehaviour("joystick_dpad4", joystick_dpad4);
AFRAME.registerInputBehaviour("msft_mr_axis_with_deadzone", msft_mr_axis_with_deadzone); AFRAME.registerInputBehaviour("msft_mr_axis_with_deadzone", msft_mr_axis_with_deadzone);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<link rel="shortcut icon" type="image/png" href="/favicon.ico"/> <link rel="shortcut icon" type="image/png" href="/favicon.ico"/>
<title>Enter Code | Hubs by Mozilla</title> <title>Enter Code | Hubs by Mozilla</title>
<link href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,300i,400,400i,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,300i,400,400i,700" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
</head> </head>
<body> <body>
......
...@@ -6,10 +6,12 @@ import en from "react-intl/locale-data/en"; ...@@ -6,10 +6,12 @@ import en from "react-intl/locale-data/en";
import { lang, messages } from "../utils/i18n"; import { lang, messages } from "../utils/i18n";
import classNames from "classnames"; import classNames from "classnames";
import styles from "../assets/stylesheets/link.scss"; import styles from "../assets/stylesheets/link.scss";
import { disableiOSZoom } from "../utils/disable-ios-zoom";
const MAX_DIGITS = 4; const MAX_DIGITS = 4;
addLocaleData([...en]); addLocaleData([...en]);
disableiOSZoom();
class LinkRoot extends Component { class LinkRoot extends Component {
static propTypes = { static propTypes = {
...@@ -106,7 +108,8 @@ class LinkRoot extends Component { ...@@ -106,7 +108,8 @@ class LinkRoot extends Component {
<div className={styles.enteredDigits}> <div className={styles.enteredDigits}>
<input <input
className={styles.digitInput} className={styles.digitInput}
type="number" type="tel"
pattern="[0-9]*"
value={this.state.enteredDigits} value={this.state.enteredDigits}
onChange={ev => { onChange={ev => {
this.setState({ enteredDigits: ev.target.value }); this.setState({ enteredDigits: ev.target.value });
......
import MobileDetect from "mobile-detect";
const mobiledetect = new MobileDetect(navigator.userAgent);
export function disableiOSZoom() {
if (!mobiledetect.is("iPhone") && !mobiledetect.is("iPad")) return;
let lastTouchAtMs = 0;
document.addEventListener("touchmove", ev => {
if (ev.scale === 1) return;
ev.preventDefault();
});
document.addEventListener("touchend", ev => {
const now = new Date().getTime();
const isDoubleTouch = now - lastTouchAtMs <= 300;
lastTouchAtMs = now;
if (isDoubleTouch) {
ev.preventDefault();
}
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment