From 050cb4f1a1992ac039d9419849ba2b9271a8723f Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Mon, 24 Aug 2026 15:21:18 +0300 Subject: [PATCH 1/3] chore: add missing changelog entries --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d3fe5e..1f0ae95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,20 @@ - Support time inputs [#245] - Add initial support for shadow_root [#234] - Support `Capybara::Cuprite::Node#rect` [#276] +- Extend `Node#set` with the `datetime-local` input type [#295] +- Support HTML5 drag-and-drop and drag modifier keys in `Node#drag_to` [#315] +- Support `Element#drop` for files and strings [#316] ### Changed +- Bump Ferrum dependency to `~> 0.18.0` ### Fixed -- Ensure node has focus before setting value [#280] +- Ensure the node has focus before setting value [#280] - Raise `ObsoleteNode` instead of silently acting on a node that got disconnected from the DOM between being found and being used [#239] - `Capybara::Cuprite::Node#send_keys` ignores empty or nil keys instead of raising, matching the Selenium and rack_test drivers [#313] +- `Driver#switch_to_frame` accepts a `Capybara::Cuprite::Node` instead of only a wrapped `Capybara::Node::Element` [#312] +- Report `tag_name` as `"ShadowRoot"` for shadow root nodes [#318] +- Treat non-summary descendants of a closed `
` element as non-visible [#317] - `switch_to_window` sends `Target.activateTarget` so Chrome reactivates the window's renderer immediately instead of leaving it backgrounded, which could stall the next input command for several seconds [#321] - `Node#set` fires `input` and `change` events for a `color` input, since its value can only be set via JavaScript and never gets them naturally [#229] From 8955efeaa80c8ade262cba482ed1a5438b0e260e Mon Sep 17 00:00:00 2001 From: David Runger Date: Sun, 25 Aug 2024 13:19:08 -0500 Subject: [PATCH 2/3] Generate a FocusEvent (not Event) for focus-related events --- lib/capybara/cuprite/javascripts/index.js | 2 +- spec/features/session_spec.rb | 4 ++-- spec/support/public/test.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/capybara/cuprite/javascripts/index.js b/lib/capybara/cuprite/javascripts/index.js index 7c3d3b8..092c022 100644 --- a/lib/capybara/cuprite/javascripts/index.js +++ b/lib/capybara/cuprite/javascripts/index.js @@ -464,7 +464,7 @@ class Cuprite { options["button"] || 0, null ) } else if (EVENTS.FOCUS.indexOf(name) != -1) { - event = this.obtainEvent(name); + event = new FocusEvent(name, { bubbles: true, cancelable: true }); } else if (EVENTS.FORM.indexOf(name) != -1) { event = this.obtainEvent(name); } else { diff --git a/spec/features/session_spec.rb b/spec/features/session_spec.rb index d21f5c3..209c326 100644 --- a/spec/features/session_spec.rb +++ b/spec/features/session_spec.rb @@ -227,11 +227,11 @@ end it "fires the focus event" do - expect(@session.find(:css, "#changes_on_focus").text).to eq("Focus") + expect(@session.find(:css, "#changes_on_focus").text).to eq("Focus (FocusEvent)") end it "fires the blur event" do - expect(@session.find(:css, "#changes_on_blur").text).to eq("Blur") + expect(@session.find(:css, "#changes_on_blur").text).to eq("Blur (FocusEvent)") end it "fires the keydown event before the value is updated" do diff --git a/spec/support/public/test.js b/spec/support/public/test.js index 6dc3195..4a275ee 100644 --- a/spec/support/public/test.js +++ b/spec/support/public/test.js @@ -28,10 +28,10 @@ $(function() { $("#changes_on_keypress").text(increment) }) .focus(function(event) { - $("#changes_on_focus").text("Focus") + $("#changes_on_focus").text(`Focus (${event.originalEvent.constructor.name})`) }) - .blur(function() { - $("#changes_on_blur").text("Blur") + .blur(function(event) { + $("#changes_on_blur").text(`Blur (${event.originalEvent.constructor.name})`) }) $("#change_me_color") From 3047b60f60d0b5a6534643286e7415ce40d466dc Mon Sep 17 00:00:00 2001 From: Dmitry Vorotilin Date: Mon, 24 Aug 2026 18:49:26 +0300 Subject: [PATCH 3/3] chore: add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f0ae95..9a09adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Treat non-summary descendants of a closed `
` element as non-visible [#317] - `switch_to_window` sends `Target.activateTarget` so Chrome reactivates the window's renderer immediately instead of leaving it backgrounded, which could stall the next input command for several seconds [#321] - `Node#set` fires `input` and `change` events for a `color` input, since its value can only be set via JavaScript and never gets them naturally [#229] +- Generate a `FocusEvent` (not a generic `Event`) for focus-related events (`blur`, `focus`, `focusin`, `focusout`), matching real browser behavior [#272] ### Removed