Skip to content

Commit 4e60ee9

Browse files
thefallentreeclaude
andcommitted
web_shell_override: mask password prompts with CSS, never input.type=password
Mirrors fluffos/fluffos@eaa1a6ee into this repo's copy (pack_lib_for_web.sh prefers it over the release zip's own index.html at publish time). Reported live: iOS Safari kept showing its AutoFill quick-suggestion bar (passwords/cards/contacts icons) above the keyboard even during ordinary command typing, well after any password prompt had passed. Root cause: the command input toggled between type="text" and type="password" on the SAME persistent <input> element, and WebKit's AutoFill heuristic sticks to an element as a credential field for the rest of the page's life once it's ever been type="password", regardless of the type reverting afterward. Replaced the type toggle with a `.masked` CSS class applying -webkit-text-security:disc (WebKit/Blink; not Firefox, but that only affects legibility, never functionality, and iOS/Chrome cover the overwhelming majority of mobile traffic here) -- input.type never changes from "text" now. Verified against a real packed site (rzrmud): type stays "text" through the toggle, the computed style applies/clears correctly, and a masked field visibly renders bullet dots. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VyQCUoTo1Z93Py9aVFHQi1
1 parent c7cfadd commit 4e60ee9

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

scripts/web_shell_override/index.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@
185185
flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg);
186186
font: inherit; padding: 10px 16px 10px 8px;
187187
}
188+
/* Password-style masking WITHOUT ever setting type="password": once an
189+
<input> has been type="password" even briefly, iOS/Safari's AutoFill
190+
heuristic sticks to it as a credential field for the rest of the
191+
page's life (the passwords/cards/contacts QuickType bar keeps showing
192+
above the keyboard even after switching back to type="text" --
193+
reported live). This mud never wants the browser's credential
194+
manager involved at all (autocomplete=off already says so) -- the
195+
masking is purely visual, so do it with CSS instead and never touch
196+
`type`. -webkit-text-security is WebKit/Blink-only (not in Firefox);
197+
acceptable here since it only affects whether typed characters are
198+
LEGIBLE, never functionality, and iOS/Chrome cover the overwhelming
199+
majority of mobile traffic this page sees. */
200+
#cmd.masked { -webkit-text-security: disc; }
188201
.modal-overlay {
189202
position: fixed; inset: 0; background: rgba(4, 6, 10, 0.72);
190203
display: flex; align-items: center; justify-content: center;
@@ -833,7 +846,8 @@ <h2 id="errorModalTitle">Driver crashed</h2>
833846
s.telnet.onText = (t) => s.term.write(t);
834847
s.telnet.onEcho = (on) => {
835848
s.serverEchoes = on;
836-
if (view === s && !s.charMode) input.type = on ? 'password' : 'text';
849+
// CSS-only masking, never input.type -- see the #cmd.masked rule.
850+
if (view === s && !s.charMode) input.classList.toggle('masked', on);
837851
};
838852
s.telnet.onCharMode = (on) => {
839853
if (on === s.charMode) return;
@@ -898,7 +912,7 @@ <h2 id="errorModalTitle">Driver crashed</h2>
898912
status.textContent = s.disconnected ? 'disconnected'
899913
: s.connId >= 0 ? 'connected (conn ' + s.connId + ')'
900914
: 'connecting…';
901-
input.type = s.serverEchoes ? 'password' : 'text';
915+
input.classList.toggle('masked', s.serverEchoes);
902916
input.disabled = s.disconnected || s.connId < 0;
903917
refit(s);
904918
if (!input.disabled && view === s) input.focus();
@@ -1007,7 +1021,7 @@ <h2 id="errorModalTitle">Driver crashed</h2>
10071021
const s = activeGame;
10081022
const line = input.value;
10091023
input.value = '';
1010-
if (input.type !== 'password') s.term.write(line + '\r\n');
1024+
if (!s.serverEchoes) s.term.write(line + '\r\n');
10111025
s.sendData(Array.from(utf8enc.encode(line + '\r\n')));
10121026
});
10131027

0 commit comments

Comments
 (0)