Clear refs when the document changes, on every path

#105 · open · 0 comments

View on GitHub ↗

drakulavich

Today `syncState` (src/commands/context.ts) keeps a session's refs across any navigation: a successful `goto`, a `click` that opens a new page, and a failed one. A ref from the old page then resolves on the new one, and only the role/name check from #91 stops an action on the wrong element. Keying on the URL is wrong, because `pushState` and a `#hash` change keep the document and its refs valid. Proposal: clear the refs when the document itself changed, e.g. through a per-document marker the page scripts put on `window`, checked wherever the state is saved. This replaces the narrower #104, which covered only the failed-navigation path of #102.

Comments