Skip to content

fix(aria/combobox): closing immediately when opening programmatically with zone.js#33518

Merged
crisbeto merged 1 commit into
angular:mainfrom
crisbeto:33516/combobox-focusout
Jul 10, 2026
Merged

fix(aria/combobox): closing immediately when opening programmatically with zone.js#33518
crisbeto merged 1 commit into
angular:mainfrom
crisbeto:33516/combobox-focusout

Conversation

@crisbeto

Copy link
Copy Markdown
Member

The combobox was using an effect to decide whether to close the overlay, however this was brittle because it relied on the effect scheduler to run once all bindings have been evaluated. This was breaking down with Zone.js which seemed to fire the effect for each signal change individually.

These changes resolve the issue by moving the logic into the focusout handler which gives us a better indication about where the event is coming from.

Fixes #33516.

… with zone.js

The combobox was using an effect to decide whether to close the overlay, however this was brittle because it relied on the effect scheduler to run once all bindings have been evaluated. This was breaking down with Zone.js which seemed to fire the effect for each signal change individually.

These changes resolve the issue by moving the logic into the `focusout` handler which gives us a better indication about where the event is coming from.

Fixes angular#33516.
@crisbeto crisbeto requested a review from ok7sai July 10, 2026 10:31
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jul 10, 2026
@pullapprove pullapprove Bot requested a review from tjshiu July 10, 2026 10:31
onFocusout(event: FocusEvent) {
onFocusout() {
// Give focus some time to move before we check it.
setTimeout(() => {

@crisbeto crisbeto Jul 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of the timeout, but I don't know if there's a better way to give it some time for focus to move into the popup.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it's probably just necessary...

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jul 10, 2026
@crisbeto crisbeto merged commit def7bc2 into angular:main Jul 10, 2026
34 of 36 checks passed
@crisbeto

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

crisbeto added a commit that referenced this pull request Jul 10, 2026
… with zone.js (#33518)

The combobox was using an effect to decide whether to close the overlay, however this was brittle because it relied on the effect scheduler to run once all bindings have been evaluated. This was breaking down with Zone.js which seemed to fire the effect for each signal change individually.

These changes resolve the issue by moving the logic into the `focusout` handler which gives us a better indication about where the event is coming from.

Fixes #33516.

(cherry picked from commit def7bc2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: aria/combobox target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(aria/combobox): setting expanded programmatically closes the popup immediately under Zone.js (works zoneless)

2 participants