cuprite icon indicating copy to clipboard operation
cuprite copied to clipboard

Generate a FocusEvent (not Event) for focus-related events

Open davidrunger opened this issue 1 year ago • 3 comments

Currently on main, focus-related events (blur, focus, focusin, and focusout) create a JavaScript Event object.

However, as can be seen by clicking into and out of the input in this JSFiddle (tested in Firefox 130 and Chrome 128), those events should actually be JavaScript FocusEvent objects (not Event objects).

This change makes it so that Cuprite will generate FocusEvent objects (not Event objects) for focus-related events.

davidrunger avatar Aug 25 '24 22:08 davidrunger

Context

The reason that this initially came to my attention (and my motivation for this change) is that a JavaScript library that I use (element-plus) actually validates that focus and blur events are indeed instances of FocusEvent.

Because currently on main Cuprite generates Event objects (not FocusEvent objects), warnings are printed when I execute in my application's test suite a feature spec that uses the Capybara fill_in method (which triggers focus and blur events) to fill in one of the inputs managed by that element-plus library:

image

This change makes it so that those warnings are no longer printed when I use the Capybara fill_in method to fill in an input for which the focus and blur event types are validated by element-plus.

davidrunger avatar Aug 25 '24 22:08 davidrunger

Looking at the Ruby 3.3 test run, there are five failing specs (link).

I believe that none of those failures are related to my change, and that those failures are already present on main. All five of those tests also fail when I run the test suite locally on main.

Edit: I submitted a separate PR to fix these spec failures.

davidrunger avatar Aug 25 '24 22:08 davidrunger

Looking at the Ruby 3.3 test run, there are five failing specs (link).

I believe that none of those failures are related to my change, and that those failures are already present on main. All five of those tests also fail when I run the test suite locally on main.

I have submitted a separate PR to fix these spec failures that currently exist on the main branch: https://github.com/rubycdp/cuprite/pull/273.

davidrunger avatar Aug 26 '24 03:08 davidrunger