Fully remote. Building everywhere.

Back to the journal
Release notes ·

form-guard 1.0.1.A reliability release.

Fewer false alarms, client-side routing that works again, and a modal that works properly with a keyboard. A drop-in update for our unsaved-changes guard.

npm packageBug fixesAccessibilityTypeScript
THE VERSION1.0.1 · patch
THE UPGRADEDrop-in · no breaking changes
01 · WHY UPGRADE

On 1.0.0?
Upgrade today.

@oblique-code/form-guard warns people before they lose unsaved form changes: on refresh, tab close, the back button and link clicks. It has zero dependencies, weighs about 5 kB gzipped and comes with React and Vue adapters.

The first fix below affects every page that uses the library, so if you are on 1.0.0, please upgrade. It is a drop-in replacement.

npm i @oblique-code/form-guard@1.0.1
02 · THE IMPORTANT FIXES

Fewer false alarms.
Better behavior.

  • No more false “Leave site?” warnings. The browser’s leave dialog now only appears when there are unsaved changes.
  • Client-side routing works again. After someone confirms they want to leave, the link click is replayed, so Next.js, React Router and similar routers navigate without a full page reload.
  • Ctrl/Cmd-click, middle-click, downloads and in-page #anchor links are never intercepted.
  • One prompt, not two. Choosing “Leave” in the modal no longer triggers the browser’s own dialog as well, and several guards on one page share a single prompt.
  • Failed validation no longer counts as a save. A form submitted with an empty required field stays protected.
  • addForm() keeps unsaved changes, removeForm() updates the dirty state, and a native form reset is detected.
03 · ACCESSIBILITY

A modal that works
for everyone.

The confirmation modal now actually receives keyboard focus. Before, focus stayed on the page behind it, so the Tab trap and Escape key didn’t work as intended. The “Leave” button’s color contrast now meets WCAG AA in light and dark mode, checked with an automated axe-core audit.

04 · PACKAGING

Easier to install,
in any setup.

  • The stylesheet ships as dist/styles.css: import @oblique-code/form-guard/styles.css or load it from a CDN. The old /src/styles.css path still works.
  • TypeScript types now work for CommonJS require() as well as import, with every moduleResolution setting.
  • Bundlers no longer drop the CSS import, and sites with a strict Content-Security-Policy get a styled modal automatically.
05 · WORTH KNOWING

Three small
behavior changes.

  • A guard you have called disable() on never prompts.
  • reset() only fires clean if the form was actually dirty.
  • Submitting an invalid form no longer resets the guard.
06 · HOW WE TESTED IT

Tested in
real browsers.

This release adds a full test suite: unit tests, plus end-to-end tests in Chromium, Firefox and WebKit covering native dialogs, keyboard use, client-side routing, the back button, every form field type and an accessibility audit. Most of the fixes above were found by those tests.

Read the full changelog (opens in a new tab)
07 · WHAT’S NEXT

Coming in
version 1.1.

Version 1.1 focuses on framework ergonomics: an isDirty value that re-renders in React, ready-made helpers for Next.js, React Router and Vue Router, and getChanges() to see exactly which fields changed.

See the roadmap (opens in a new tab)
Questions, ideas or a bug to report?

Join the conversation on GitHub. We read every reply, and it shapes what goes into the next version.

Join the discussion (opens in a new tab)
KEEP READING

More from the journal

All posts
GOOD THINGS START WITH A CONVERSATION

Have a little idea?
Let’s make it big.

Tell us what you’re thinking. We’ll help with what comes next.

A real builder replies within one working day.