Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: document state #744

Closed
3 tasks done
ph-fritsche opened this issue Oct 15, 2021 · 0 comments · Fixed by #747
Closed
3 tasks done

feat: document state #744

ph-fritsche opened this issue Oct 15, 2021 · 0 comments · Fixed by #747
Labels
enhancement New feature or request
Milestone

Comments

@ph-fritsche
Copy link
Member

ph-fritsche commented Oct 15, 2021

The state of the document which the user sees and interacts with in the browser is not always reflected by the properties and methods on the document. (Displayed value diverging from value property; selection on elements without support for selectionStart/selectionEnd)
Also some behavior in the browser depends on circumstances before our interaction with the document in a userEvent.* call . (If a change event is fired on blur depends on the initial value when the element gained focus. But the value can change between gaining focus and the userEvent.* call.)
See #714

We've applied workarounds for this here:

Todo:

  • Collect our workarounds for UI document state diverging from API document state at one place in our codebase
  • Provide one entry point to prepare the document with our workarounds
    Attaching event handlers to the capture phase of focus and blur seems like a good start to intercept information that is otherwise lost for us.
    We probably should replace the implementations of setSelectionRange and Selection so that we can intercept programmatic changes by event handlers and at the same time apply the "visible" selection as we calculated it.
  • Provide an internal API used by all our implementations to get or set values or selections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant