From a21bb6b02d0089fd18ba4a72e9bf3eba85fdac2c Mon Sep 17 00:00:00 2001 From: egrs Date: Wed, 18 Feb 2026 14:06:36 +0100 Subject: [PATCH] dispatch focusin/focusout events with relatedTarget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit focus() and blur() now dispatch all four spec-required FocusEvents: blur (no bubble) → focusout (bubbles) → focus (no bubble) → focusin (bubbles) Each event carries the correct relatedTarget: the element gaining focus for blur/focusout, and the element losing focus for focus/focusin. All four events are composed per W3C spec. Relates to #1161 --- src/browser/tests/document/focus.html | 166 ++++++++++++++++++++++++ src/browser/webapi/Element.zig | 48 +++++-- src/browser/webapi/event/FocusEvent.zig | 15 ++- 3 files changed, 216 insertions(+), 13 deletions(-) diff --git a/src/browser/tests/document/focus.html b/src/browser/tests/document/focus.html index 3e72e1d4..2ec33cde 100644 --- a/src/browser/tests/document/focus.html +++ b/src/browser/tests/document/focus.html @@ -81,6 +81,172 @@ + + + + + + + + + + + +