Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="tedi-header-language__label"
>{{ "header.select-lang" | tediTranslate }}</span
>
<tedi-popover [withBorder]="true" position="bottom">
<tedi-popover [withBorder]="true" position="bottom" [preventOverflow]="true" appendTo="">
<button
type="button"
tedi-popover-trigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</ng-container>

<ng-container *showAt="dropdown">
<tedi-popover [withBorder]="true" position="bottom">
<tedi-popover [withBorder]="true" position="bottom" [preventOverflow]="true" appendTo="">
<button
tedi-button
tedi-popover-trigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ tedi-header-profile {
display: flex;
flex-direction: column;
width: var(--navigation-vertical-item-width-default);
max-width: 100%;
min-height: calc(100dvh - var(--layout-header-min-height));
max-height: 100%;
overflow-y: auto;
background: var(--general-surface-primary);

> * {
>* {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

padding: var(--layout-header-modal-item-padding);

&:not(:last-child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}

<ng-container *ngIf="representatives().length > 1; else normalText">
<tedi-popover [withBorder]="true" position="bottom">
<tedi-popover [withBorder]="true" position="bottom" [preventOverflow]="true" appendTo="">
<button
type="button"
tedi-popover-trigger
Expand Down
2 changes: 1 addition & 1 deletion tedi/components/overlay/popover/popover.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#floatUiComponent
looseTrigger="none"
ariaRole="dialog"
appendTo="body"
[appendTo]="appendTo()"
[floatUiLoose]="floatUiComponent"
[targetElement]="popoverTrigger().host.nativeElement"
[loosePlacement]="position()"
Expand Down
13 changes: 10 additions & 3 deletions tedi/components/overlay/popover/popover.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PopoverContentComponent } from "./popover-content/popover-content.compo
<tedi-popover
[position]="position"
[preventOverflow]="preventOverflow"
[appendTo]="appendTo"
[dismissible]="dismissible"
[hideOnScroll]="hideOnScroll"
[withBorder]="withBorder"
Expand All @@ -28,6 +29,7 @@ import { PopoverContentComponent } from "./popover-content/popover-content.compo
class TestHostComponent {
position: PopoverPosition = "top";
preventOverflow = false;
appendTo = "body";
dismissible = true;
hideOnScroll = false;
withBorder = false;
Expand Down Expand Up @@ -91,9 +93,14 @@ describe("PopoverComponent", () => {
expect(trigger?.getAttribute("aria-haspopup")).toBe("dialog");
});

it('should have appendTo="body" on float-ui-content', () => {
const floatUiContent = hostEl.querySelector("float-ui-content");
expect(floatUiContent?.getAttribute("appendTo")).toBe("body");
it('should have default appendTo="body" on float-ui-content', () => {
expect(component.appendTo()).toBe("body");
});

it("should update appendTo when input changes", () => {
hostComponent.appendTo = "";
fixture.detectChanges();
expect(component.appendTo()).toBe("");
});

it("should not include the border class by default", () => {
Expand Down
6 changes: 6 additions & 0 deletions tedi/components/overlay/popover/popover.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export class PopoverComponent implements AfterContentChecked {
* @default false
*/
lockScroll = input(false);
/**
* Append floating element to given selector.
* Use 'body' to append at the end of DOM or empty string to append next to trigger element.
* @default "body"
*/
readonly appendTo = input("body");
/** Delay time (in ms) for closing popover when not hovering trigger or content.
* @default 100
*/
Expand Down
Loading