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.
Fixesangular#33516.
@crisbeto
crisbeto requested a review from ok7saiJuly 10, 2026 10:31
@crisbetocrisbeto added the target: patch This PR is targeted for the next patch release label Jul 10, 2026
@pullapprove
pullapproveBot requested a review from tjshiuJuly 10, 2026 10:31
onFocusout(event: FocusEvent) {
onFocusout() {
// Give focus some time to move before we check it.
setTimeout(() => {

@crisbetocrisbetoJul 10, 2026

Copy link
Copy Markdown
MemberAuthor

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...

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

Copy link
Copy Markdown
MemberAuthor

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)
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-botangular-automatic-lock-botBot locked and limited conversation to collaborators Aug 10, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: mergeThe PR is ready for merge by the caretakerarea: aria/comboboxtarget: patchThis 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

@crisbeto@ok7sai