Repository navigation
form-guard 1.0.1: a reliability release #2
nurulanam
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
form-guard 1.0.1: a reliability release
@oblique-code/form-guardwarns users before they lose unsaved form changes: on refresh, tab close, back button and link clicks. Zero dependencies, about 5 KB gzipped, with React and Vue adapters.1.0.1 is a bug-fix release with no breaking API changes. If you use 1.0.0, please upgrade. The first fix below affects every page that uses the library.
The important fixes
<Link>, React Router and similar routers navigate normally.#anchorlinks are no longer intercepted.novalidate, submitting a form with an empty required field used to mark it clean. It now stays protected until a valid submit.addForm()no longer discards unsaved changes,removeForm()updates the dirty state, and native form reset (<button type="reset">) is detected.Packaging
dist/styles.css, importable as@oblique-code/form-guard/styles.cssor from the CDN. The old/src/styles.csspath still works. The previous standalone stylesheet didn't actually match the modal; it does now.require()too, and with everymoduleResolutionsetting.Behaviour changes worth knowing
disable()d never prompts.reset()only firescleanif the form was actually dirty.Tested in real browsers
This release adds a test suite: unit tests, plus end-to-end tests in Chromium, Firefox and WebKit covering native dialogs, keyboard use, single-page routing, back/forward, every form field type, and an automated accessibility audit with axe-core. Most of the fixes above were found by those tests.
What's next
v1.1 is planned around framework ergonomics: a re-rendering
isDirtyfor React, helpers for Next.js, React Router and Vue Router, andgetChanges()to see which fields changed. See the roadmap.Bug reports and feedback are welcome in the issues.
All reactions