Skip to content

fix(free): keep focus after removing a selected chip (#288) - #289

Merged
MrDarkRoot merged 2 commits into
mainfrom
fix/288-chip-focus
Oct 15, 2026
Merged

MrDarkRoot merged 2 commits into
mainfrom
fix/288-chip-focus

Conversation

@MrDarkRoot

Copy link
Copy Markdown
Owner

Summary

  • After a chip is removed, focus moves to the remaining chip's remove control. If it was the last chip, focus moves to the search field when that field is in the tab order, otherwise to Clear selected products.
  • document.activeElement is not body. Focus uses preventScroll so the page does not jump. The no-JS submit path is unchanged.

Lab proof

Chrome 148 on http://127.0.0.1:18092, after copying this free-selection.js into the running acceptance lab:

  • Two chips: Enter on the first remove control left focus on button.writeleash-chip__remove (Remove Harbor Tee…), not body. Scroll delta 0.
  • Last chip: focus moved to #writeleash-free-product_search, not body.

Local bash .github/ci/pr-fast.sh: #133 PR_FAST PASS.

Do not merge. Only @MrDarkRoot merges.

Fixes #288

Focus the remaining chip, or the search field or Clear when it was the last. Do not leave focus on body.
Headless Chrome scrolls an off-screen chip into view before preventScroll applies. Restore the pre-click scroll and keep focus on the remaining chip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui(free): focus is lost after removing a selected product chip

1 participant