Open
Conversation
Currently the javascript used to set a field value will trigger a "focus" event prior to updating a field however this does not set the input as focused so any use of `document.activeElement` will return the body element. To fix this a call to `node.focus()` has been added before the focus event to ensure `document.activeElement` will respond correctly.
b390fde to
63c4547
Compare
|
Hi @route, I've tidied up this PR to reduce the dependabot changes from our fork. Is there any chance you're able to review this? Thanks! |
seanpdoyle
added a commit
to seanpdoyle/cuprite
that referenced
this pull request
Dec 22, 2025
Closes rubycdp#157 Related to rubycdp#280 Change the `lib/capybara/cuprite/javascripts/index.js` to invoke [HTMLElement.focus][] directly, rather than triggering a synthetic `"focus"` event. [HTMLElement.focus]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JS for filling in a field does not focus the element before filling it in, only triggers the focus event. This causes failures when checking the
document.activeElementas the input will not be focused.This fixes the issue by calling
focuson the node before triggering the event.