The "Name, if Other" box shows on every row, including the kinds that already have a name #284
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#284
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A row that names a known kind — VAT number, ORCID, Mobile — still draws an empty box labelled “Name, if Other” beside it. The box is meaningless for every kind but one, it is the widest thing competing with the value for space, and it invites somebody to type in it. It should appear when the kind is Other, and not otherwise.
The rule is not new: the display side already follows it.
CompanyIdentifier.scheme_label(jobs/models.py:432) andPersonIdentifier.display_label(accounts/models.py:225) both use the label only when the scheme isother, and fall back to the registry's name for every other scheme. The form is the one place that contradicts what the rest of the code already knows.Where it is
Three row types, each a
kind/schemeselect with an Other-only name box drawn unconditionally beside it:templates/jobs/company_form.html:79-82templates/accounts/profile.html:152-155templates/partials/phone_numbers.html:43-44The registry has 11 schemes (
plugins/identifiers/schemes.py), of whichotheris one — the only one whose uniqueness constraint is deliberately relaxed, because it is “a labelled free slot” (jobs/models.py:359). The model field says the same in its own help text: “What the identifier is, when the scheme is Other.”The two identifier blocks are byte-identical — same grid, same three columns, same delete control — duplicated across two templates. #263 made a component layer for exactly this; if the markup is being touched anyway, it should become one
<c-…>rather than two copies that can drift.Web links are not part of this.
partials/web_links.html:32renders the same model field but the template relabels it “Name”, and the block already fixes the kind, so the field is meaningful on every row there. Worth noting only because the underlying field'sverbose_nameisname, if Other(core/models.py:404) and reads wrongly for that use — a one-word correction, not a behaviour change.The defect underneath it
Nothing clears
labelwhen the scheme stops being Other. NeitherCompanyIdentifierForm.clean(jobs/forms.py:289) norPersonIdentifierForm.clean(accounts/forms.py:528) touches it: they check that a scheme was chosen and a value typed, and that is all. So typing a name, then changing the kind to VAT number, stores the name — wherescheme_labelthen ignores it. The value is invisible everywhere and still in the database and the export.That is the half worth fixing regardless of what the form draws: when the scheme is not Other, the label should be blanked on save.
How to hide it without a script
Postulo does not ship controls that need JavaScript to work, so the obvious
changehandler is not the answer on its own. Two pieces, and the second is already an established technique here:other.:has()for changes made on the page, so switching the select reveals the box with nothing loaded.app.css:823and:833already use:has(), so this is not a new dependency. The shape is a row that hides the column unless the select'sotheroption is:checked— which updates live as the selection changes, with no script at all.One rule this must not break: never hide a box that has something in it. If a row somehow carries a label with a non-Other scheme — every row written before this lands can — hiding the field makes a stored value invisible and unremovable. The template should keep the column when
row.label.valueis non-empty, whatever the scheme. Combined with the blank-on-save above, such rows clean themselves up the next time they are saved.Points to settle
sm:grid-cols-[minmax(0,12rem)_minmax(0,1fr)_minmax(0,10rem)_auto]— so rows with the box and rows without it will not line up unless this is decided. Either keep the track and leave it empty (rows stay aligned, 10rem of nothing on most rows), or let Identifier take the space and accept that a row grows when it becomes Other. The second reads better and is the reason to do this at all; it should be looked at with several rows on screen before choosing.scheme_label, which tells nobody anything. Requiring it once the field is the only one showing is cheap and probably right — but it is a new validation error on an existing form, so say so deliberately.Notes for whoever takes it
tests/e2e/test_reflow.py(320 pixels) andtest_target_size.pywill both notice a changed grid; the profile page is one of the pages #167 found running off a narrow screen, so check it there.npm run build:cssif the templates gain classes, since the compiled CSS is committed and CI checks it.tests/test_page_coverage.pyis unaffected but the two pages both want a browser check, because they are the same markup in two layouts.fr-fr,pt-ptandpt-brasdraft; the other 36 at the release sweep.