🌐 AI搜索 & 代理 主页
Skip to content

jQuery 3.4.0+ silences native focus handlers attached after jQuery ones #5015

@IanSimpson

Description

@IanSimpson

Description

This may be related to the dicussion/resolution for #4856, but is a distinct issue.

If you have a Google Address autocomplete input, and trigger focus programatically (e.g. $('input').trigger('focus')) the autocomplete works fine. However, if you add any other focus event listener (event just an empty function, like $('input').on('focus', function() {})) then the autocomplete won't work until manually focused (e.g. through clicking or tabbing).

Link to test case

Test case is at https://jsfiddle.net/bgmrujdt/1/. First autocomplete has a focus event handler, focusing by clicking the button does not work. Second autocomplete doesn't have a focus event handler, focusing by clicking the button does work.

The same code with jQuery 3.3.1 works fine (example at https://jsfiddle.net/bgmrujdt/2/). It also works fine using native javascript .focus() instead of jQuery (https://jsfiddle.net/s2zmhb9t/)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions