Tags and industries: removing a chip with the keyboard drops focus to the start of the page #519
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
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#519
Loading…
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?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, reading the label-chip control instatic/js/app.js.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atstatic/js/app.js:1679-1694(the two remove callbacks),static/js/app.js:1657-1667(drawLabels, down tolist.textContent = "") andstatic/js/app.js:1711-1736(chipFor); the two templates have not moved.Each chip's remove button calls back into
drawLabels, which empties the chip list and builds every chip again. The button that had focus is destroyed and nothing is focused in its place, so focus falls to the document. This is the shape #227 and #257 fixed for pagination, sorting and the reminder tick (a control that removes itself must hand focus on), applied nowhere in the chip control.static/js/app.js:1446-1461(the two remove callbacks:value.set(false)orwriteTyped(…), thensayIt(…), thendrawLabels(box));static/js/app.js:1424-1434(drawLabelsbegins withlist.textContent = "");static/js/app.js:1478-1503(chipForbuilds a new button each time). There is no.focus()call on the removal path.templates/partials/tags_field.html, tags) or on a company form (templates/jobs/company_form.html:47-70, industries) tabs to a chip's remove button and presses Enter. The live region says the label was removed, and focus is now on<body>. The next Tab starts from the skip link, so removing three labels means walking past the header three times, and a screen reader is left with no position.tests/e2e/test_labels.pyremoves chips by click and checks counts and announcements, not where focus goes;test_the_arrows_walk_between_labelsshows the control is meant to be keyboard-operated.drawLabels, focus the remove button now at that index, else the one before it, else the chip input when no chips remain. Only do so when focus was on the removed button, so a removal started by the pointer does not move focus unexpectedly.Done when
tests/e2e/test_labels.pyfocuses the first chip's remove button on a company with two industries, presses Enter, and asserts that the remaining chip's remove button is focused; a second press asserts that the chip input is focused. It fails today and passes after the fix.