Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 63d26b2d70edb81acd9873c1a3911412120efc9d
      
https://github.com/WebKit/WebKit/commit/63d26b2d70edb81acd9873c1a3911412120efc9d
  Author: Alexsander Borges Damaceno <[email protected]>
  Date:   2026-02-25 (Wed, 25 Feb 2026)

  Changed paths:
    M Source/WebCore/page/FocusController.cpp
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/WindowBlurInputChangeEvent.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKInputDelegate.mm

  Log Message:
  -----------
  change event not firing when the window loses focus.
https://bugs.webkit.org/show_bug.cgi?id=135552

Reviewed by Ryosuke Niwa.

The change event was not firing when switching to another window,
even if the value of an input element had changed. Only the blur event was 
being dispatched.
This happened because the change event was only dispatched when focus moved to 
another elements in the window.
When switching windows, the focused node did not change, so the event was not 
fired.
This was fixed by checking whether the element’s contents had changed whenever 
the window lost focus.
If so, the change event is dispatched.

This aligns the behavior with Firefox and Chrome.

It was not possible to test this using an HTML test.
Rniwa helped me a lot in creating the correct API test.

* Source/WebCore/page/FocusController.cpp:
(WebCore::dispatchEventsOnWindowAndFocusedElement):
Test: Tools/TestWebKitAPI/SourcesCocoa.txt
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WindowBlurInputChangeEvent.mm
* Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKInputDelegate.mm

Canonical link: https://commits.webkit.org/308203@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to