Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions apps/prs/angular/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
<div style="min-height: 100vh; display: flex; flex-direction: column">
<section slot="header" class="width" role="header" style="flex: 0 0 auto">
<section slot="header" id="top" class="width" role="header" style="flex: 0 0 auto">
<goab-microsite-header type="alpha" version="UAT" />
<goab-app-header>
<a href="/">Home</a>
<goab-app-header-menu heading="Insights">
<a class="interactive" href="/bugs/bug2720">2878</a>
<a href="/">Regional Insights</a>
<a href="/">Occupational Insights</a>
<a href="/bugs/bug2720"> bug2720 </a>
<a href="/bugs/3450"> Dropdown expanding </a>
<a href="/bugs/3450"> ...inside Container </a>
<a href="/bugs/3450">
Interactive super long menu item to test overflow handling lorem ipsum dolor sit
amet
</a>
<a href="/bugs/3450">
Noninteractive super long menu item to test overflow handling lorem ipsum dolor
sit amet
</a>
</goab-app-header-menu>
<goab-app-header-menu heading="Popover">
<a href="/bugs/3450"> Bug 3450 </a>
<a href="/bugs/3450">Bug 3450</a>
<a href="/bugs/3450">
Super long menu item to test overflow handling lorem ipsum dolor sit amet
</a>
</goab-app-header-menu>
<goa-app-header-menu heading="John Smith" leadingIcon="person-circle">
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent component name: This line uses 'goa-app-header-menu' instead of 'goab-app-header-menu'. All other instances in this file use the 'goab-' prefix. This should be changed to 'goab-app-header-menu' to match the consistent naming convention used throughout the file.

Copilot uses AI. Check for mistakes.
<a href="#top">Manage account</a>
<a href="#top">Request new staff account for a long</a>
<a href="#top">System admin</a>
<a href="#top" class="interactive">Sign out</a
><a href="/bugs/3450">
Super long menu item to test overflow handling lorem ipsum dolor sit amet
</a>
</goa-app-header-menu>
</goab-app-header>
</section>

Expand Down Expand Up @@ -57,6 +81,7 @@
<a href="/bugs/3337">3337 - Autocomplete styling</a>
<a href="/bugs/3279">3279</a>
<a href="/bugs/3384">3384 Table v2 sample</a>
<a href="/bugs/3450">Bug 3450</a>
</goab-side-menu-group>
<goab-side-menu-group heading="Features">
<a href="/features/1328">1328</a>
Expand Down
3 changes: 3 additions & 0 deletions apps/prs/angular/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { Bug3281Component } from "../routes/bugs/3281/bug3281.component";
import { Bug3337Component } from "../routes/bugs/3337/bug3337.component";
import { Bug3279Component } from "../routes/bugs/3279/bug3279.component";
import { Bug3384Component } from "../routes/bugs/3384/bug3384.component";
import { Bug3450Component } from "../routes/bugs/3450/bug3450.component";

import { Feat1328Component } from "../routes/features/feat1328/feat1328.component";
import { Feat1383Component } from "../routes/features/feat1383/feat1383.component";
Expand Down Expand Up @@ -118,6 +119,8 @@ export const appRoutes: Route[] = [
{ path: "bugs/3337", component: Bug3337Component },
{ path: "bugs/3279", component: Bug3279Component },
{ path: "bugs/3384", component: Bug3384Component },
{ path: "bugs/3450", component: Bug3450Component },

// Feature routes
{ path: "features/1328", component: Feat1328Component },
{ path: "features/1383", component: Feat1383Component },
Expand Down
40 changes: 40 additions & 0 deletions apps/prs/angular/src/routes/bugs/3450/bug3450.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div>
<h1>Bug 3450 - Dropdown expanding inside Container</h1>

<goab-block gap="m" direction="row">
<goab-container>
<p>The GoabDropdown below should expand outside of the container.</p>

<goab-form-item label="Basic GoabDropdown">
<goab-dropdown placeholder="-- Watch me Expand --">
<goab-dropdown-item value="1" label="Option 1"></goab-dropdown-item>
<goab-dropdown-item value="2" label="Option 2"></goab-dropdown-item>
<goab-dropdown-item value="3" label="Option 3"></goab-dropdown-item>
</goab-dropdown>
</goab-form-item>
</goab-container>
<goab-container>
<p>The GoabDatePicker below should expand outside of the container.</p>

<goab-form-item label="Basic GoabDatePicker">
<goab-date-picker></goab-date-picker>
</goab-form-item>
</goab-container>
</goab-block>

<h2>Testing Directions</h2>
<p>This is a test of GoabPopover not GoabDropdown or GoabDatePicker.</p>
<ul>
<li>
Open the GoabDropdown and GoabDatePicker and verify that they expand outside of the
container.
</li>
<li>
Verify that the GoabDropdown and GoabDatePicker are not cut off by the container.
</li>
<li>
Shrink and expand the window to cause the GoabDropdown and GoabDatePicker to expand
upwards instead.
</li>
</ul>
</div>
26 changes: 26 additions & 0 deletions apps/prs/angular/src/routes/bugs/3450/bug3450.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component } from "@angular/core";
import { CommonModule } from "@angular/common";
import {
GoabBlock,
GoabContainer,
GoabDatePicker,
GoabDropdown,
GoabDropdownItem,
GoabFormItem,
} from "@abgov/angular-components";

@Component({
standalone: true,
selector: "abgov-bug3450",
templateUrl: "./bug3450.component.html",
imports: [
CommonModule,
GoabBlock,
GoabContainer,
GoabDatePicker,
GoabDropdown,
GoabDropdownItem,
GoabFormItem,
],
})
export class Bug3450Component {}
34 changes: 32 additions & 2 deletions apps/prs/react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Link, Outlet } from "react-router-dom";
import {
GoabAppFooter,
GoabAppHeader,
GoabAppHeaderMenu,
GoabMicrositeHeader,
GoabOneColumnLayout,
GoabSideMenu,
Expand All @@ -12,9 +13,37 @@ import "@abgov/style";
export function App() {
return (
<GoabOneColumnLayout>
<section slot="header">
<section slot="header" id="top">
<GoabMicrositeHeader type="alpha" version="UAT" />
<GoabAppHeader heading="Testing Playground" url="/"></GoabAppHeader>
<GoabAppHeader heading="Testing Playground" url="/">
<a href="/">Home</a>
<GoabAppHeaderMenu heading="Insights">
<a href="/bugs/bug2720">bug2720</a>
<a href="/bugs/3450">Dropdown expanding</a>
<a href="/bugs/3450">...inside Container</a>
<a href="/bugs/3450">
Super long menu item to test overflow handling lorem ipsum dolor sit amet
</a>
</GoabAppHeaderMenu>
<GoabAppHeaderMenu heading="Popover">
<a href="/bugs/3450">Bug 3450</a>
<a href="/bugs/3450">Bug 3450</a>
<a href="/bugs/3450">
Super long menu item to test overflow handling lorem ipsum dolor sit amet
</a>
</GoabAppHeaderMenu>
<GoabAppHeaderMenu heading="John Smith" leadingIcon="person-circle">
<a href="#top">Manage account</a>
<a href="#top">Request new staff account</a>
<a href="#top">System admin</a>
<a href="#top" className="interactive">
Sign out
</a>
<a href="/bugs/3450">
Super long menu item to test overflow handling lorem ipsum dolor sit amet
</a>
</GoabAppHeaderMenu>
</GoabAppHeader>
</section>
<div style={{ display: "flex", minHeight: "100vh" }}>
<section
Expand Down Expand Up @@ -67,6 +96,7 @@ export function App() {
<Link to="/bugs/3337">3337 Input autocomplete styling</Link>
<Link to="/bugs/3279">3279 Work Side Menu Key Nav</Link>
<Link to="/bugs/3384">3384 v2 Table Border</Link>
<Link to="/bugs/3450">3450 Dropdown expanding inside Container</Link>
</GoabSideMenuGroup>
<GoabSideMenuGroup heading="Features">
<Link to="/features/1383">1383 Button Filled Icons</Link>
Expand Down
2 changes: 2 additions & 0 deletions apps/prs/react/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { Bug3322Route } from "./routes/bugs/bug3322";
import { Bug3281Route } from "./routes/bugs/bug3281";
import { Bug3337Route } from "./routes/bugs/bug3337";
import { Bug3384Route } from "./routes/bugs/bug3384";
import { Bug3450Route } from "./routes/bugs/bug3450";

import { EverythingRoute } from "./routes/everything";
import { EverythingBRoute } from "./routes/everything-b";
Expand Down Expand Up @@ -129,6 +130,7 @@ root.render(
<Route path="bugs/3281" element={<Bug3281Route />} />
<Route path="bugs/3337" element={<Bug3337Route />} />
<Route path="bugs/3384" element={<Bug3384Route />} />
<Route path="bugs/3450" element={<Bug3450Route />} />

<Route path="features/1383" element={<Feat1383Route />} />
<Route path="features/1547" element={<Feat1547Route />} />
Expand Down
54 changes: 54 additions & 0 deletions apps/prs/react/src/routes/bugs/bug3450.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
GoabBlock,
GoabContainer,
GoabDatePicker,
GoabDropdown,
GoabDropdownItem,
GoabFormItem,
} from "@abgov/react-components";

export function Bug3450Route() {
return (
<div>
<h1>Bug 3450 - Dropdown expanding inside Container</h1>

<GoabBlock gap="m" direction="row">
<GoabContainer>
<p>The GoabDropdown below should expand outside of the container.</p>

<GoabFormItem label="Basic GoabDropdown">
<GoabDropdown placeholder="-- Watch me Expand --">
<GoabDropdownItem value="1" label="Option 1" />
<GoabDropdownItem value="2" label="Option 2" />
<GoabDropdownItem value="3" label="Option 3" />
</GoabDropdown>
</GoabFormItem>
</GoabContainer>
<GoabContainer>
<p>The GoabDatePicker below should expand outside of the container.</p>

<GoabFormItem label="Basic GoabDatePicker">
<GoabDatePicker></GoabDatePicker>
</GoabFormItem>
</GoabContainer>
</GoabBlock>

<h2>Testing Directions</h2>
<p>This is a test of GoabPopover not GoabDropdown or GoabDatePicker.</p>
<ul>
<li>
Open the GoabDropdown and GoabDatePicker and verify that they expand outside of
the container.
</li>
<li>
Verify that the GoabDropdown and GoabDatePicker are not cut off by the
container.
</li>
<li>
Shrink and expand the window to cause the GoabDropdown and GoabDatePicker to
expand upwards instead.
</li>
</ul>
</div>
);
}
6 changes: 3 additions & 3 deletions libs/react-components/specs/popover.browser.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe("Popover", () => {
await vi.waitFor(() => {
const popoverContentEl = result.getByTestId("popover-content");
expect(popoverContentEl.element()).toBeTruthy();
expect(popoverContentEl.element().style.bottom).toBe("auto");
expect(popoverContentEl.element().style.bottom).toBe("");
});
});

Expand Down Expand Up @@ -150,7 +150,7 @@ describe("Popover", () => {
const popoverContentEl = result.getByTestId("popover-content");
expect(popoverContentEl.element()).toBeTruthy();
// It should be a number ending with px when opening upwards
expect(popoverContentEl.element().style.bottom).toMatch(/-?\d+px/);
expect(popoverContentEl.element().style.top).toMatch(/-?\d+px/);
});
});

Expand Down Expand Up @@ -199,7 +199,7 @@ describe("Popover", () => {
const popoverContentEl = result.getByTestId("popover-content");
expect(popoverContentEl.element()).toBeTruthy();
// bottom should be set to 'auto' when opening downwards
expect(popoverContentEl.element().style.bottom).toBe("auto");
expect(popoverContentEl.element().style.bottom).toBe("");
});
});
});
Expand Down
16 changes: 8 additions & 8 deletions libs/web-components/src/components/popover/Popover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@
: null;

const popoverRect = getBoundingClientRectWithMargins(_popoverEl);
const offsetParent = _popoverEl.offsetParent as HTMLElement | null;
const offsetParentTop = offsetParent?.getBoundingClientRect().top || 0;

// exit if the popover hasn't yet been filled
if (popoverRect.height < 20) return;
Expand All @@ -432,9 +434,12 @@
: position === "above";

if (displayOnTop) {
_popoverEl.style.bottom = `${targetRect.height}px`;
const topPos = targetRect.top - popoverRect.height - offsetParentTop;
_popoverEl.style.top = `${topPos}px`;
} else {
_popoverEl.style.bottom = "auto"; // In case this is triggered by _sectionHeight is changed
// Clear top/bottom to keep default below-target static positioning.
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The comment mentions "static positioning" but the popover-content element has position: absolute (see line 551 in the style section). Consider updating the comment to clarify that clearing these properties allows the element to use its default absolute positioning relative to its offsetParent, which places it below the target.

Suggested change
// Clear top/bottom to keep default below-target static positioning.
// Clear top/bottom so the popover uses its default absolute positioning
// relative to its offsetParent, which places it below the target.

Copilot uses AI. Check for mistakes.
_popoverEl.style.top = "";
_popoverEl.style.bottom = "";
}

// Move the popover to the left if it is too far to the right and only if there is space to the left
Expand Down Expand Up @@ -480,12 +485,7 @@
<slot name="target" />
</button>

<div
style={styles(
style("display", _open ? "block" : "none"),
style("position", "relative"),
)}
>
<div style={styles(style("display", _open ? "block" : "none"))}>
<section
bind:clientHeight={_sectionHeight}
bind:this={_popoverEl}
Expand Down