Skip to content

Instantly share code, notes, and snippets.

@myfonj
Created November 6, 2025 23:28
Show Gist options
  • Select an option

  • Save myfonj/cca46c91b2c1692ea70bc57c2b60b733 to your computer and use it in GitHub Desktop.

Select an option

Save myfonj/cca46c91b2c1692ea70bc57c2b60b733 to your computer and use it in GitHub Desktop.
<!doctype html><html lang="en" style="color-scheme: dark light;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Vanilla "password strength" app</title>
<style>
form
{ font-family: sans-serif
; width: max-content
; padding: 1em
; margin: 1em
; box-shadow: 0 0 1ex color-mix(in srgb, currentcolor, transparent)
}
li
{ &::marker { content: '☐ ' / 'Missing:' }
; &:has(:valid)
{ color: selectedItemText
; background-color: selectedItem;
; &::marker
{ content: '☑ ' / 'OK: '
; color: selectedItem
}
}
}
ul { padding: 0 1em }
[pattern] { display: none }
</style>
<body>
<form action="">
<input type="password" oninput="[...form.elements].forEach(_=>_.value=value)" placeholder="placeholder is not label">
<ul>
<li><input required pattern=".{8,}"> 8+ characters
<li><input required pattern=".{12,}"> 12+ characters
<li><input required pattern=".*[a-z].*"> Lowercase letter
<li><input required pattern=".*[A-Z].*"> Uppercase letter
<li><input required pattern=".*\d.*"> Number
<li><input required pattern=".*[^a-zA-Z0-9].*"> Special character
</ul>
</form>
<plaintext style="white-space: pre-wrap">
Variation of https://backbonenotbad.hyperclay.com/ using just the "platform" for funsies.
So no external resource. No React. No Backbone. No Tailwind.
Admittedly cutting corners quite brutally.
Replicates most flaws of the original(s):
- Accessibility disaster: no labels, no aria-live regions, no clear indication what is going on.
-- (Added a feeble attempt with CSS content "alt"s, but I doubt any current SR would catch them.)
- Resilience disaster: no features detection, no graceful degradation.
- Will break in any fairly outdated user agent. Will not work without JS (just like the original, but now even worse, rendering non-functional UI. (There should be server-side fallback anyway.)
@myfonj
Copy link
Author

myfonj commented Nov 6, 2025

Inspired by React and Backbone counterparts.

Test in sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment