-
Notifications
You must be signed in to change notification settings - Fork 37
fix(#3892): stop popover from closing parent popover, drawer, or modal #3913
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
apps/prs/angular/src/routes/bugs/3892/bug3892.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| <div style="display: grid; gap: 1.5rem"> | ||
| <div style="display: grid; gap: 0.5rem"> | ||
| <h1 style="margin: 0">3892 - Nested close propagation</h1> | ||
| <p style="margin: 0 0 1rem;"> | ||
| This page tests the issue where popover close events are propegating to parent | ||
| drawers and modals. | ||
| </p> | ||
| </div> | ||
|
|
||
| <goab-container> | ||
| <div style="display: grid; gap: 1.5rem"> | ||
| <h2 style="margin: 0">Popover</h2> | ||
| <p style="margin: 0 0 1rem;">Open the popover and interact with all controls.</p> | ||
| </div> | ||
|
|
||
| <ng-template #popoverTarget> | ||
| <goab-button type="primary">Open popover</goab-button> | ||
| </ng-template> | ||
|
|
||
| <goab-popover [target]="popoverTarget"> | ||
| <div style="display: grid; gap: 1rem; min-width: 20rem"> | ||
| <p style="margin: 0 0 1rem;"> | ||
| Expected: using the date picker, dropdown, and menu button updates values | ||
| and leaves the popover open. | ||
| </p> | ||
| <goab-date-picker | ||
| name="bug3892-popover-date" | ||
| [value]="popoverDate" | ||
| (onChange)="handlePopoverDateChange($event)" | ||
| ></goab-date-picker> | ||
| <goab-dropdown | ||
| name="bug3892-popover-province" | ||
| placeholder="Select a province" | ||
| [value]="popoverProvince" | ||
| (onChange)="handlePopoverProvinceChange($event)" | ||
| > | ||
| <goab-dropdown-item value="alberta" label="Alberta"></goab-dropdown-item> | ||
| <goab-dropdown-item value="british-columbia" label="British Columbia"></goab-dropdown-item> | ||
| <goab-dropdown-item value="manitoba" label="Manitoba"></goab-dropdown-item> | ||
| <goab-dropdown-item value="ontario" label="Ontario"></goab-dropdown-item> | ||
| <goab-dropdown-item value="quebec" label="Quebec"></goab-dropdown-item> | ||
| </goab-dropdown> | ||
| <goab-menu-button text="Popover actions"> | ||
| <goab-menu-action action="edit" text="Edit"></goab-menu-action> | ||
| <goab-menu-action action="archive" text="Archive"></goab-menu-action> | ||
| <goab-menu-action action="delete" text="Delete"></goab-menu-action> | ||
| </goab-menu-button> | ||
| </div> | ||
| </goab-popover> | ||
| </goab-container> | ||
|
|
||
| <goab-container> | ||
| <div style="display: grid; gap: 1.5rem"> | ||
| <h2 style="margin: 0">Drawer</h2> | ||
| <p style="margin: 0 0 1rem;">Open the drawer and interact with all controls.</p> | ||
| </div> | ||
|
|
||
| <goab-button (onClick)="openDrawer()">Open drawer</goab-button> | ||
|
|
||
| <goab-drawer | ||
| heading="Test drawer" | ||
| maxSize="36rem" | ||
| [open]="drawerOpen" | ||
| position="right" | ||
| (onClose)="handleDrawerClose()" | ||
| > | ||
| <div style="display: grid; gap: 1rem"> | ||
| <p style="margin: 0 0 1rem;"> | ||
| Expected: using the date picker, dropdown, and menu button updates values | ||
| and leaves the drawer open. | ||
| </p> | ||
| <goab-date-picker | ||
| name="bug3892-drawer-date" | ||
| [value]="drawerDate" | ||
| (onChange)="handleDrawerDateChange($event)" | ||
| ></goab-date-picker> | ||
| <goab-dropdown | ||
| name="bug3892-drawer-province" | ||
| placeholder="Select a province" | ||
| [value]="drawerProvince" | ||
| (onChange)="handleDrawerProvinceChange($event)" | ||
| > | ||
| <goab-dropdown-item value="alberta" label="Alberta"></goab-dropdown-item> | ||
| <goab-dropdown-item value="british-columbia" label="British Columbia"></goab-dropdown-item> | ||
| <goab-dropdown-item value="manitoba" label="Manitoba"></goab-dropdown-item> | ||
| <goab-dropdown-item value="ontario" label="Ontario"></goab-dropdown-item> | ||
| <goab-dropdown-item value="quebec" label="Quebec"></goab-dropdown-item> | ||
| </goab-dropdown> | ||
| <goab-menu-button text="Drawer actions"> | ||
| <goab-menu-action action="edit" text="Edit"></goab-menu-action> | ||
| <goab-menu-action action="archive" text="Archive"></goab-menu-action> | ||
| <goab-menu-action action="delete" text="Delete"></goab-menu-action> | ||
| </goab-menu-button> | ||
| </div> | ||
| </goab-drawer> | ||
| </goab-container> | ||
|
|
||
| <goab-container> | ||
| <h2 style="margin: 0">Push drawer</h2> | ||
| <p style="margin: 0 0 1rem;">Open the push drawer and interact with all controls.</p> | ||
|
|
||
| <div style="display: flex; min-height: 440px"> | ||
| <goab-button (onClick)="openPushDrawer()">Open push drawer</goab-button> | ||
|
|
||
| <goab-push-drawer | ||
| heading="Controls inside push drawer" | ||
| width="36rem" | ||
| [open]="pushDrawerOpen" | ||
| (onClose)="handlePushDrawerClose()" | ||
| > | ||
| <div style="display: grid; gap: 1.5rem"> | ||
| <p style="margin: 0 0 1rem;"> | ||
| Expected: using the date picker, dropdown, and menu button updates values | ||
| and leaves the push drawer open. | ||
| </p> | ||
| <goab-date-picker | ||
| name="bug3892-push-drawer-date" | ||
| [value]="pushDrawerDate" | ||
| (onChange)="handlePushDrawerDateChange($event)" | ||
| ></goab-date-picker> | ||
| <goab-dropdown | ||
| name="bug3892-push-drawer-province" | ||
| placeholder="Select a province" | ||
| [value]="pushDrawerProvince" | ||
| (onChange)="handlePushDrawerProvinceChange($event)" | ||
| > | ||
| <goab-dropdown-item value="alberta" label="Alberta"></goab-dropdown-item> | ||
| <goab-dropdown-item value="british-columbia" label="British Columbia"></goab-dropdown-item> | ||
| <goab-dropdown-item value="manitoba" label="Manitoba"></goab-dropdown-item> | ||
| <goab-dropdown-item value="ontario" label="Ontario"></goab-dropdown-item> | ||
| <goab-dropdown-item value="quebec" label="Quebec"></goab-dropdown-item> | ||
| </goab-dropdown> | ||
| <goab-menu-button text="Push drawer actions"> | ||
| <goab-menu-action action="edit" text="Edit"></goab-menu-action> | ||
| <goab-menu-action action="archive" text="Archive"></goab-menu-action> | ||
| <goab-menu-action action="delete" text="Delete"></goab-menu-action> | ||
| </goab-menu-button> | ||
| </div> | ||
| </goab-push-drawer> | ||
| </div> | ||
| </goab-container> | ||
|
|
||
| <goab-container> | ||
| <div style="display: grid; gap: 1.5rem"> | ||
| <h2 style="margin: 0">Modal</h2> | ||
| <p style="margin: 0 0 1rem;">Open the modal and interact with all controls.</p> | ||
| </div> | ||
|
|
||
| <goab-button (onClick)="openModal()">Open modal</goab-button> | ||
|
|
||
| <goab-modal | ||
| heading="Controls inside modal" | ||
| [open]="modalOpen" | ||
| [closable]="true" | ||
| (onClose)="handleModalClose()" | ||
| > | ||
| <div style="display: grid; gap: 1rem"> | ||
| <p style="margin: 0 0 1rem;"> | ||
| Expected: using the date picker, dropdown, and menu button updates values | ||
| and leaves the modal open. | ||
| </p> | ||
| <goab-date-picker | ||
| name="bug3892-modal-date" | ||
| [value]="modalDate" | ||
| (onChange)="handleModalDateChange($event)" | ||
| ></goab-date-picker> | ||
| <goab-dropdown | ||
| name="bug3892-modal-province" | ||
| placeholder="Select a province" | ||
| [value]="modalProvince" | ||
| (onChange)="handleModalProvinceChange($event)" | ||
| > | ||
| <goab-dropdown-item value="alberta" label="Alberta"></goab-dropdown-item> | ||
| <goab-dropdown-item value="british-columbia" label="British Columbia"></goab-dropdown-item> | ||
| <goab-dropdown-item value="manitoba" label="Manitoba"></goab-dropdown-item> | ||
| <goab-dropdown-item value="ontario" label="Ontario"></goab-dropdown-item> | ||
| <goab-dropdown-item value="quebec" label="Quebec"></goab-dropdown-item> | ||
| </goab-dropdown> | ||
| <goab-menu-button text="Modal actions"> | ||
| <goab-menu-action action="edit" text="Edit"></goab-menu-action> | ||
| <goab-menu-action action="archive" text="Archive"></goab-menu-action> | ||
| <goab-menu-action action="delete" text="Delete"></goab-menu-action> | ||
| </goab-menu-button> | ||
| </div> | ||
| </goab-modal> | ||
| </goab-container> | ||
| </div> |
111 changes: 111 additions & 0 deletions
111
apps/prs/angular/src/routes/bugs/3892/bug3892.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import { CommonModule } from "@angular/common"; | ||
| import { Component } from "@angular/core"; | ||
| import { | ||
| GoabButton, | ||
| GoabContainer, | ||
| GoabDatePicker, | ||
| GoabDrawer, | ||
| GoabDropdown, | ||
| GoabDropdownItem, | ||
| GoabMenuAction, | ||
| GoabMenuButton, | ||
| GoabModal, | ||
| GoabPopover, | ||
| GoabPushDrawer, | ||
| } from "@abgov/angular-components"; | ||
| import type { | ||
| GoabDatePickerOnChangeDetail, | ||
| GoabDropdownOnChangeDetail, | ||
| } from "@abgov/ui-components-common"; | ||
|
|
||
| @Component({ | ||
| standalone: true, | ||
| selector: "abgov-bug3892", | ||
| templateUrl: "./bug3892.component.html", | ||
| imports: [ | ||
| CommonModule, | ||
| GoabButton, | ||
| GoabContainer, | ||
| GoabDatePicker, | ||
| GoabDrawer, | ||
| GoabDropdown, | ||
| GoabDropdownItem, | ||
| GoabMenuAction, | ||
| GoabMenuButton, | ||
| GoabModal, | ||
| GoabPopover, | ||
| GoabPushDrawer, | ||
| ], | ||
| }) | ||
| export class Bug3892Component { | ||
| popoverDate = ""; | ||
| popoverProvince = ""; | ||
|
|
||
| drawerOpen = false; | ||
| drawerDate = ""; | ||
| drawerProvince = ""; | ||
|
|
||
| pushDrawerOpen = false; | ||
| pushDrawerDate = ""; | ||
| pushDrawerProvince = ""; | ||
|
|
||
| modalOpen = false; | ||
| modalDate = ""; | ||
| modalProvince = ""; | ||
|
|
||
| handlePopoverDateChange(detail: GoabDatePickerOnChangeDetail): void { | ||
| this.popoverDate = detail.valueStr || ""; | ||
| } | ||
|
|
||
| handlePopoverProvinceChange(detail: GoabDropdownOnChangeDetail): void { | ||
| this.popoverProvince = detail.value || ""; | ||
| } | ||
|
|
||
| openDrawer(): void { | ||
| this.drawerOpen = true; | ||
| } | ||
|
|
||
| handleDrawerClose(): void { | ||
| this.drawerOpen = false; | ||
| } | ||
|
|
||
| handleDrawerDateChange(detail: GoabDatePickerOnChangeDetail): void { | ||
| this.drawerDate = detail.valueStr || ""; | ||
| } | ||
|
|
||
| handleDrawerProvinceChange(detail: GoabDropdownOnChangeDetail): void { | ||
| this.drawerProvince = detail.value || ""; | ||
| } | ||
|
|
||
| openPushDrawer(): void { | ||
| this.pushDrawerOpen = true; | ||
| } | ||
|
|
||
| handlePushDrawerClose(): void { | ||
| this.pushDrawerOpen = false; | ||
| } | ||
|
|
||
| handlePushDrawerDateChange(detail: GoabDatePickerOnChangeDetail): void { | ||
| this.pushDrawerDate = detail.valueStr || ""; | ||
| } | ||
|
|
||
| handlePushDrawerProvinceChange(detail: GoabDropdownOnChangeDetail): void { | ||
| this.pushDrawerProvince = detail.value || ""; | ||
| } | ||
|
|
||
| openModal(): void { | ||
| this.modalOpen = true; | ||
| } | ||
|
|
||
| handleModalClose(): void { | ||
| this.modalOpen = false; | ||
| } | ||
|
|
||
| handleModalDateChange(detail: GoabDatePickerOnChangeDetail): void { | ||
| this.modalDate = detail.valueStr || ""; | ||
| } | ||
|
|
||
| handleModalProvinceChange(detail: GoabDropdownOnChangeDetail): void { | ||
| this.modalProvince = detail.value || ""; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "type": "bug", | ||
| "id": "3892", | ||
| "path": "bugs/3892", | ||
| "title": "Nested close propagation" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { Bug3892Route } from "../../../routes/bugs/bug3892"; | ||
| import type { PrRouteDefinition } from "../../route-manifest"; | ||
|
|
||
| export default { | ||
| type: "bug", | ||
| id: "3892", | ||
| path: "bugs/3892", | ||
| title: "Nested close propagation", | ||
| component: Bug3892Route, | ||
| } satisfies PrRouteDefinition; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.