-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/overlaydocsThis issue is related to documentationThis issue is related to documentation
Description
Documentation Feedback
The CDK Overlay example is missing a crucial event handler. Specifically, when using the ESC
key to close the overlay, the parent component's state isn't properly updated, leading to inconsistent behavior:
-
Current behavior (demonstrated in the StackBlitz):
- Closing with ESC requires two clicks to reopen
-
The solution is to add the detach handler (demonstrated in the StackBlitz):
<ng-template
cdkConnectedOverlay
[cdkConnectedOverlayOrigin]="trigger"
[cdkConnectedOverlayOpen]="isOpen"
(detach)="isOpen = false" <!-- Add this line -->
>
<!-- content -->
</ng-template>
Here is a StackBlitz link that demonstrates both the issue and the working solution with the detach handler. I'm ready to submit a PR implementing these changes once this approach is confirmed.
Affected documentation page
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/overlaydocsThis issue is related to documentationThis issue is related to documentation