Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(cdk/overlay): attach() and detach are not working in zoneless apps #28456

Closed
1 task
javiermarinros opened this issue Jan 19, 2024 · 3 comments
Closed
1 task
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@javiermarinros
Copy link

javiermarinros commented Jan 19, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The Overlay attach() and detach() methods are relying on the ngZone.onStable observable that is never invoked using the new provideZonelessChangeDetection app provider.

The related actual code:

  // Update the position once the zone is stable so that the overlay will be fully rendered
    // before attempting to position it, as the position may depend on the size of the rendered
    // content.
    this._ngZone.onStable.pipe(take(1)).subscribe(() => {
      // The overlay could've been detached before the zone has stabilized.
      if (this.hasAttached()) {
        this.updatePosition();
      }
    });

Expected Behavior

Overlays to attach and position themselves in zoneless aplications

Actual Behavior

Overlay is created but not positioned and not visible

Environment

  • Angular: 17.1
  • CDK/Material: 17.1
@javiermarinros javiermarinros added the needs triage This issue needs to be triaged by the team label Jan 19, 2024
@javiermarinros javiermarinros changed the title bug(cdk/overlay): attach() is not working in zoneless apps bug(cdk/overlay): attach() and detach are not working in zoneless apps Jan 19, 2024
@atscott
Copy link
Contributor

atscott commented Jan 20, 2024

Indeed, this is the case everywhere in the repo that uses NgZone APIs. This particular one has a WIP fix here #28332

@andrewseguin andrewseguin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: cdk/overlay and removed needs triage This issue needs to be triaged by the team labels Jan 29, 2024
@crisbeto
Copy link
Member

crisbeto commented Sep 9, 2024

Should be fixed now that #28332 has landed.

@crisbeto crisbeto closed this as completed Sep 9, 2024
@angular-automatic-lock-bot
Copy link

This issue 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-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: cdk/overlay P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

4 participants