jquery / jquery

jQuery JavaScript Library
https://jquery.com
MIT License
58.93k stars 20.62k forks source link

Issue or behaviour??? - 2.2.3 to 3.6.0 - active element changed on focus. #5475

Closed thambiduraidevmahendran closed 3 weeks ago

thambiduraidevmahendran commented 1 month ago

I recently updated my website's jQuery version from 2.2.3 to 3.6.0 and noticed a change in behavior. Here's the structure of my elements:

div svg g id='childgroup' /g /svg div div div span id='childspan' /span /div /div /div /div

In jQuery 2.2.3, when I execute the following code:

let childspan = $('#childspan'); let childgroup = $('#childgroup');

childspan.focus(); childgroup.focus();

The active element remains as childspan even after focusing on childgroup. However, in jQuery 3.6.0, executing the same code results in the active element becoming childgroup.

Could someone please explain why this behavior change occurs in the updated jQuery version? Is it an expected behavior change? Thank you in advance.

mgol commented 1 month ago

Please try jQuery 3.7.1. jQuery 3.6 & older had some focus issues we fixed in 3.7. Some bugs were 3.6-specific.

mgol commented 3 weeks ago

Closing for now; we can reopen if the issue is still in 3.7.1 and we have a test case.