Skip to content

Commit 0889a4f

Browse files
chapterjasonclaude
andcommitted
Suppress native keyboard and fix iOS Safari v86 boot
Sets inputmode=none on the demo textarea and xterm's helper textarea so mobile browsers don't pop the native OSK while tap-positioning still works. Copies both v86.wasm and v86-fallback.wasm into public/v86/build/ at fetch time and points v86 there, so the fallback is reachable on browsers without SharedArrayBuffer (iOS Safari on GitHub Pages). Memory shrunk to 128 MB / 2 MB VGA to stay under iOS limits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 60457a6 commit 0889a4f

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

scripts/fetch-v86-assets.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createWriteStream, existsSync, mkdirSync, statSync } from "node:fs";
1+
import { copyFileSync, createWriteStream, existsSync, mkdirSync, statSync } from "node:fs";
22
import { dirname, join } from "node:path";
33
import { pipeline } from "node:stream/promises";
44
import { fileURLToPath } from "node:url";
@@ -35,3 +35,12 @@ for (const f of files) {
3535
process.exitCode = 1;
3636
}
3737
}
38+
39+
const wasms = ["v86.wasm", "v86-fallback.wasm"];
40+
for (const name of wasms) {
41+
const src = join(root, "node_modules/v86/build", name);
42+
const out = join(root, "public/v86/build", name);
43+
mkdirSync(dirname(out), { recursive: true });
44+
copyFileSync(src, out);
45+
console.log(`✓ copied ${name}`);
46+
}

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</div>
2727
<div class="demo">
2828
<label for="demo-input">Tap into the field, then use the keyboard below:</label>
29-
<textarea id="demo-input" autofocus placeholder="Type here...">Lorem ipsum dolor sit amet,
29+
<textarea id="demo-input" autofocus inputmode="none" placeholder="Type here...">Lorem ipsum dolor sit amet,
3030
consectetur adipiscing elit.
3131
Sed do eiusmod tempor incididunt
3232
ut labore et dolore magna aliqua.

src/linux.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { WebLinksAddon } from "@xterm/addon-web-links";
77
import "@xterm/xterm/css/xterm.css";
88
// @ts-expect-error — v86 ships no types
99
import V86 from "v86";
10-
import wasmUrl from "v86/build/v86.wasm?url";
1110
import "./keyboard/virtual-keyboard";
1211
import { terminalAdapter } from "./keyboard/output";
1312

@@ -44,6 +43,7 @@ term.loadAddon(new WebLinksAddon());
4443

4544
const host = document.getElementById("term")!;
4645
term.open(host);
46+
term.textarea?.setAttribute("inputmode", "none");
4747
fit.fit();
4848
term.loadAddon(new LigaturesAddon());
4949

@@ -63,9 +63,9 @@ term.writeln("\x1b[1;36mLinux on v86\x1b[0m — x86 emulator in WebAssembly");
6363
term.writeln("Booting from linux4.iso (busybox)…\r\n");
6464

6565
const emulator = new V86Constructor({
66-
wasm_path: wasmUrl,
67-
memory_size: 512 * 1024 * 1024,
68-
vga_memory_size: 8 * 1024 * 1024,
66+
wasm_path: HOST + "build/v86.wasm",
67+
memory_size: 128 * 1024 * 1024,
68+
vga_memory_size: 2 * 1024 * 1024,
6969
bios: { url: HOST + "bios/seabios.bin" },
7070
vga_bios: { url: HOST + "bios/vgabios.bin" },
7171
cdrom: { url: HOST + "images/linux.iso" },

0 commit comments

Comments
 (0)