Skip to content

fix: cancel observed focus delivery before it runs - #614

Closed
Amber (YuanboXue-Amber) wants to merge 2 commits into
microsoft:masterfrom
YuanboXue-Amber:users/yuanboxue/observed-focus-cancellation
Closed

Amber (YuanboXue-Amber) wants to merge 2 commits into
microsoft:masterfrom
YuanboXue-Amber:users/yuanboxue/observed-focus-cancellation

Conversation

@YuanboXue-Amber

@YuanboXue-Amber Amber (YuanboXue-Amber) commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix a race where requestFocus() could still move focus after cancellation, replacement by a newer request, or API disposal when the target was already found.

  • Track cancellation until focus is delivered and preserve the canceled status.
  • Prevent old handles from canceling newer same-name requests.
  • Keep completed requests unchanged when canceled later.

No public API or dependency changes.

Validation

  • Added browser regressions for cancellation, replacement, disposal, stale handles, and completed requests.
  • ObservedElement + CrossOrigin: 28 tests passed.
  • Shadow DOM ObservedElement: 24 tests passed.
  • Bundle build, type-check, lint, formatting, and diff checks passed.

Retain the cancellable focus operation rather than only its element wait. Stop ready-target delivery on cancellation, supersession, and disposal, while preserving already-completed focus.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
tabster
all exports
110.948 kB
30.14 kB
111.154 kB
30.181 kB
206 B
41 B
tabster
getCrossOrigin
107.881 kB
29.426 kB
108.087 kB
29.467 kB
206 B
41 B
tabster
getObservedElement
44.334 kB
13.138 kB
44.54 kB
13.183 kB
206 B
45 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
tabster
createTabster (core)
38.569 kB
11.569 kB
tabster
focusable.findAll
38.592 kB
11.577 kB
tabster
focusable.findLast
38.593 kB
11.577 kB
tabster
focusable.findNext
38.593 kB
11.577 kB
tabster
focusable.findPrev
38.593 kB
11.577 kB
tabster
getDeloser
47.93 kB
13.853 kB
tabster
getGroupper
45.671 kB
13.236 kB
tabster
getModalizer
47.596 kB
13.995 kB
tabster
getMover
53.128 kB
15.489 kB
tabster
getOutline
47.204 kB
13.807 kB
tabster
getRestorer
41.154 kB
12.166 kB
🤖 This report was generated against cc60426d5ab690bc33f01fb39144f2afd9d3ef0e

Make focus cancellation idempotent and reject a pending element wait only while it still owns its registry entry. Add browser regressions for repeated cancellation of focus requests and element waits with the same name.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant