fix(ui): clear the weekday chips on the share form's recycle path - #280
Merged
Merged
Conversation
The "every day" shortcut disables the seven weekday chips by **property** (`cb.disabled = allCb.checked`), while a successful listing recycles the form with `e.target.reset()`. `HTMLFormElement.reset()` restores values/checkedness to their defaults but does **not** clear the `disabled` property — so after one successful listing with "every day" checked the seven chips are left unchecked *and* disabled, and nothing in the session ever clears it again (the form card is static HTML, so `showShareForm` / `renderSharing` / `fillPlans` never touch it). Picking any single weekday is a no-op until the shortcut is toggled twice. Collapse the clear into one named helper, `resetShareAvail()`, and call it on both recycle roots: the reset path (`afterOk`, right after `e.target.reset()`) and the reopen path (`showShareForm`). The new gate `state_gate::a_form_control_disabled_by_the_property_is_cleared_on_ the_recycle_path` pins the shape: every channel in which a form control is disabled by property must have a same-channel `.disabled = false` inside the recycle closure (the call closure of the function that calls `form.reset()`, plus that of the functions that open the form card — both roots derived from `index.html`, no roster). A second rule refuses the over-correction of deleting the recycle path itself, and `the_form_recycle_path_scanners_have_teeth` proves each rule with synthetic inputs. The browser fact (that `reset()` does not touch the property) and the user-visible symptom are covered by a jsdom probe; shape belongs to the gate, facts belong to the probe.
Owner
Author
|
Self-review note (own PR — a formal approving review is not possible here, so this is a Verified on this head (
Two things worth a second pair of eyes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the sharing form the "every day" shortcut disables the seven weekday chips by
property:
A successful listing recycles the form with
e.target.reset().HTMLFormElement.reset()restores values and checkedness to their defaults, but it does not clear the
disabledproperty — and the property here was never set as an attribute, so there isnothing for
reset()to reflect.Result: after one successful listing with "every day" checked, the seven chips are left
unchecked and disabled. The form card is static HTML —
showShareForm,renderSharingandfillPlansnever touch it — so nothing in the session repairs it:clicking any weekday is silently swallowed until the user toggles "every day" on and off
again.
The fix collapses the clear into a single named helper and calls it on both recycle roots:
the reset path (
afterOk, immediately aftere.target.reset()) and the reopen path(
showShareForm).Related Issue
None — the repository has no open issue for this; it was found during a UI state audit.
No
Closes #N.Changes
ui/js/app.js— newresetShareAvail()helper (the single clear point for theseven chips) called from
showShareForm()and fromafterOk().ui/index.html— cache-bust bump forapp.js.src/state_gate.rs— new gatea_form_control_disabled_by_the_property_is_cleared_on_the_recycle_pathplus itsself-check
the_form_recycle_path_scanners_have_teeth(test-only module; nothingcompiles into release artifacts).
ui/README.md— documents the convention ("a form control disabled by propertymust have a same-channel
.disabled = falseon the recycle path").Tests
cargo test— 322 passed / 0 failed (baselinemain320; +2 = the two new tests).cargo fmt --check— clean.cargo clippy --all-targets -- -D warnings— clean (CI's exact command).What the gate pins (shape)
Three rules, each with its own tooth:
non-empty, and each channel derives its
<form>id and card id fromindex.html(today:
#sf-days .chip input→share-form→share-form-card, no roster)..disabled = falseinside therecycle closure = the call closure of the function that calls
form.reset()∪ thecall closures of the functions that open the form card (both roots derived from
index.html). This is RED on the pre-fix tree (witness = None) and GREEN after.cannot satisfy rule 2.
Deliberately accepted as legitimate (both roots are valid): clearing only after the reset,
or only when the form opens. Deliberately rejected: clearing inside the "every day" change
handler (not on a recycle root), and dropping the mutual exclusion (that empties the
writer set, i.e. the shortcut starts lying).
What proves the browser fact (runtime)
The gate is lexical; the browser fact (
reset()does not clear the property) and theuser-visible symptom are covered by a jsdom probe that boots the real
index.html+ thefour real scripts, stubs and logs
fetch, and drives the real controls (nav → add →provider/plan/model → the "every day" chip → a real
submit→ the realPOST→afterOk→ reopen). Nine legs, each declared per tree:
{B1,B2}FAIL, chips left-D -D -D -D -D -D -D{C2,C3,A3}FAIL — the shortcut lies and the POST no longer carries 7 daysShape belongs to the gate, facts belong to the probe.
Checklist
fix/…).one cache-bust line.