Repository navigation
Closed
Labels
bugSomething isn't working
Description
Found while verifying #950 in Chromium. It is older than that change: development at 5111d58 behaves the same.
What happens
- In the browser wizard, choose Custom on the Model step, leave the model id empty and press Next. The field gets a red border,
aria-invalid="true"and an error message (role="alert"). - Type a valid id such as
org/model. - The border,
aria-invalid="true"and the message stay. They clear only when something else re-renders the step.
The Dataset step's dataset-name field behaves the same way.
Why
Both input handlers mean to re-render once the value validates, but they compute the "before" state after assigning the new value:
- model id:
Lines 1620 to 1633 in 5111d58
input.addEventListener('input', function () { state.model = input.value.trim(); persist(); // If the operator was previously blocked on this field but // their new value now validates, drop the error visual on // next render (handled by re-running validation in render()). var prevErr = fieldHasError(state, 'model', 'model'); var stillErr = validateStep(state, 'model').some(function (e) { return e.field === 'model'; }); if (prevErr && !stillErr) { // Re-render to clear the error state cleanly. Cheap because // the only thing that changes is the .is-invalid class. rerender(); return; } - dataset name:
Lines 1690 to 1698 in 5111d58
nameInput.addEventListener('input', function () { state.datasetName = nameInput.value.trim(); persist(); var prevErr = fieldHasError(state, 'dataset', 'datasetName'); var stillErr = validateStep(state, 'dataset').some(function (e) { return e.field === 'datasetName'; }); if (prevErr && !stillErr) { rerender(); return; }
prevErr = fieldHasError(state, …) validates the value that was just assigned, so it always equals stillErr, and prevErr && !stillErr is never true. The fields on the Compliance and Operations steps clear their errors another way and are not affected.
Acceptance criteria
- When a flagged model id or dataset name becomes valid, its
is-invalidclass,aria-invalid="true"and error row clear at once, and focus and the caret stay in the field. - A field that is still invalid keeps its error while the user types.
- A regression test under
tests/site/fails on the current code and passes with the fix. Once the pull request for Associate wizard form labels with their conditional input controls #950 lands, the controller harness intests/site/wizard_harness.cjs(bootWizard) can open the step, press Next and type into the field.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(site): clear a corrected wizard field's error as soon as it valid…
fix(site): keep wizard sections, errors and focus through re-renders
fix(site): keep open sections per tab and bring a re-broken field's e…