Tags and industries: with scripts on, their validation errors are hidden along with the native controls #522

Closed
opened 2026-10-01 10:47:22 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the label-chip control in static/js/app.js against the templates it is layered over.

Checked again on 2026-10-01 against main at 0a5cad587: still present. The code is now at static/js/app.js:1831-1842 (readyLabels hiding the two boxes) and jobs/forms.py:118-124 (new_industries); the two templates are unchanged.

When the chip control takes over, readyLabels hides the whole box that holds the native control and the whole box that holds the new field. Both boxes also hold the field's <c-field-feedback>, so the help text and any role="alert" errors for tags, new tags, industries and new industries are rendered and then hidden. The chip input does not refer to them, and neither form summarises field errors anywhere else.

  • Where: static/js/app.js:1598-1609 (native.hidden = true on [data-labels-existing], newBox.hidden = true on [data-labels-newbox]); templates/partials/tags_field.html:8-16 (<c-field-feedback> for tags and new_tags inside those boxes); templates/jobs/company_form.html:47-70 (the same for industries and new_industries); jobs/forms.py:117-123 (new_industries has max_length=300; the chips write it with writeTyped, which the input's maxlength does not limit); company_form.html:12-14 summarises only non_field_errors.
  • What happens: a company form posts more than 300 characters of new industries built up as chips, or an application form posts a tag that was deleted in another tab before saving (ModelMultipleChoiceField then reports an invalid choice). The page comes back unsaved, the chips are redrawn, and no error is visible or announced.
  • Why it matters: the person sees a form that did not save and cannot tell why. With scripts off the same errors show, so the enhancement removes information the base page gives.
  • Fix: hide the controls, not their feedback: move each <c-field-feedback> outside the box the script hides, or have readyLabels hide the select, the checkbox row and the text input individually. When an error block exists, add its id to the chip input's aria-describedby.

Done when

  • A browser test in tests/e2e/test_labels.py submits a company form whose new industries exceed 300 characters, with the script on, and asserts that the new_industries error is visible. It fails today and passes after the fix.
Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading the label-chip control in `static/js/app.js` against the templates it is layered over. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. The code is now at `static/js/app.js:1831-1842` (`readyLabels` hiding the two boxes) and `jobs/forms.py:118-124` (`new_industries`); the two templates are unchanged. When the chip control takes over, `readyLabels` hides the whole box that holds the native control and the whole box that holds the *new* field. Both boxes also hold the field's `<c-field-feedback>`, so the help text and any `role="alert"` errors for tags, new tags, industries and new industries are rendered and then hidden. The chip input does not refer to them, and neither form summarises field errors anywhere else. - **Where:** `static/js/app.js:1598-1609` (`native.hidden = true` on `[data-labels-existing]`, `newBox.hidden = true` on `[data-labels-newbox]`); `templates/partials/tags_field.html:8-16` (`<c-field-feedback>` for `tags` and `new_tags` inside those boxes); `templates/jobs/company_form.html:47-70` (the same for `industries` and `new_industries`); `jobs/forms.py:117-123` (`new_industries` has `max_length=300`; the chips write it with `writeTyped`, which the input's `maxlength` does not limit); `company_form.html:12-14` summarises only `non_field_errors`. - **What happens:** a company form posts more than 300 characters of new industries built up as chips, or an application form posts a tag that was deleted in another tab before saving (`ModelMultipleChoiceField` then reports an invalid choice). The page comes back unsaved, the chips are redrawn, and no error is visible or announced. - **Why it matters:** the person sees a form that did not save and cannot tell why. With scripts off the same errors show, so the enhancement removes information the base page gives. - **Fix:** hide the controls, not their feedback: move each `<c-field-feedback>` outside the box the script hides, or have `readyLabels` hide the select, the checkbox row and the text input individually. When an error block exists, add its id to the chip input's `aria-describedby`. ## Done when - A browser test in `tests/e2e/test_labels.py` submits a company form whose new industries exceed 300 characters, with the script on, and asserts that the `new_industries` error is visible. It fails today and passes after the fix.
tiagoagueda added this to the 0.6.0 milestone 2026-10-01 10:47:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#522
No description provided.