Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(ui): position table dropdowns outside overflowing containers

Andras Bacsai70b9acc42467
diff --git a/config/constants.php b/config/constants.php
index 1e6395df8b..76e34334c2 100644
--- a/config/constants.php
+++ b/config/constants.php
@@ -2,7 +2,7 @@
return [
'coolify' => [
- 'version' => env('COOLIFY_VERSION') ?: '4.3.6',
+ 'version' => env('COOLIFY_VERSION') ?: '4.3.7',
'helper_version' => '1.0.15',
'realtime_version' => '1.0.17',
'railpack_version' => '0.23.0',
diff --git a/other/nightly/versions.json b/other/nightly/versions.json
index e32d035c55..2f449eed8c 100644
--- a/other/nightly/versions.json
+++ b/other/nightly/versions.json
@@ -1,10 +1,10 @@
{
"coolify": {
"v4": {
- "version": "4.3.6"
+ "version": "4.3.7"
},
"nightly": {
- "version": "4.3.7"
+ "version": "4.3.8"
},
"helper": {
"version": "1.0.15"
diff --git a/resources/views/components/table/dropdown.blade.php b/resources/views/components/table/dropdown.blade.php
index e236bff305..6a0472191e 100644
--- a/resources/views/components/table/dropdown.blade.php
+++ b/resources/views/components/table/dropdown.blade.php
@@ -4,13 +4,36 @@
'multiselectable' => false,
])
-<div class="relative" x-data="{ open: false }" @click.outside="open = false" @keydown.escape.window="open = false">
- <div @click="open = !open">
+<div class="relative" x-data="{
+ open: false,
+ panelStyle: 'display: none;',
+ toggle() {
+ this.open = !this.open;
+
+ if (this.open) {
+ this.$nextTick(() => this.updatePosition());
+ }
+ },
+ updatePosition() {
+ const trigger = this.$refs.trigger.getBoundingClientRect();
+ const panel = this.$refs.panel.getBoundingClientRect();
+ const viewportPadding = 8;
+ const left = Math.max(viewportPadding, Math.min(trigger.right - panel.width, window.innerWidth - panel.width - viewportPadding));
+ const spaceBelow = window.innerHeight - trigger.bottom - viewportPadding;
+ const top = spaceBelow >= panel.height
+ ? trigger.bottom + 4
+ : Math.max(viewportPadding, trigger.top - panel.height - 4);
+
+ this.panelStyle = `position: fixed; left: ${left}px; top: ${top}px;`;
+ }
+}" @click.outside="open = false" @keydown.escape.window="open = false"
+ x-on:resize.window="if (open) updatePosition()" x-on:scroll.window="if (open) updatePosition()">
+ <div x-ref="trigger" @click="toggle()">
{{ $trigger }}
</div>
- <div x-show="open" x-cloak
- class="listbox-panel absolute top-full! right-0! left-auto! mt-1! {{ $panelClass }}" role="{{ $role }}"
+ <div x-ref="panel" x-show="open" x-cloak :style="panelStyle"
+ class="listbox-panel fixed! top-auto! right-auto! bottom-auto! z-[90]! mt-0! {{ $panelClass }}" role="{{ $role }}"
@if ($multiselectable) aria-multiselectable="true" @endif>
{{ $slot }}
</div>
diff --git a/tests/Feature/StandardTableComponentsTest.php b/tests/Feature/StandardTableComponentsTest.php
index 684234518f..28f07a9a2f 100644
--- a/tests/Feature/StandardTableComponentsTest.php
+++ b/tests/Feature/StandardTableComponentsTest.php
@@ -24,8 +24,8 @@ it('renders the standard table toolbar controls', function () {
->toContain('wire:model.live="search"')
->not->toContain('x-teleport="body"')
->not->toContain('floatingDropdown(')
- ->not->toContain('position: fixed')
- ->toContain('absolute top-full')
+ ->toContain('position: fixed')
+ ->toContain('getBoundingClientRect()')
->toContain('x-show="open"')
->toContain('aria-multiselectable="true"')
->toContain('Reset filters')
diff --git a/tests/Feature/TablePaginationLoadingTest.php b/tests/Feature/TablePaginationLoadingTest.php
index f6e5f5a81a..d26a1a33da 100644
--- a/tests/Feature/TablePaginationLoadingTest.php
+++ b/tests/Feature/TablePaginationLoadingTest.php
@@ -30,6 +30,20 @@ it('renders the shared page size selector', function () {
->toContain('max="100"');
});
+it('positions table dropdown panels outside overflowing containers', function () {
+ $html = Blade::render(<<<'BLADE'
+ <x-table.dropdown>
+ <x-slot:trigger><button type="button">Open</button></x-slot:trigger>
+ <button type="button">Option</button>
+ </x-table.dropdown>
+ BLADE);
+
+ expect($html)
+ ->toContain('position: fixed')
+ ->toContain('getBoundingClientRect()')
+ ->toContain('x-on:scroll.window');
+});
+
it('renders compact client-side pagination', function () {
$html = Blade::render('<x-client-pagination summary="1-10 of 20" page-size-model="pageSize" storage-key="tests.page-size" />');
diff --git a/tests/Unit/ProductionImageWorkflowTest.php b/tests/Unit/ProductionImageWorkflowTest.php
index c7d1229d2f..754eca1c30 100644
--- a/tests/Unit/ProductionImageWorkflowTest.php
+++ b/tests/Unit/ProductionImageWorkflowTest.php
@@ -23,9 +23,9 @@ it('publishes v4 branch builds under the commit sha with a traceable internal ve
->toContain('ARG COOLIFY_VERSION')
->toContain('ENV COOLIFY_VERSION=${COOLIFY_VERSION}')
->and($constants)
- ->toContain("'version' => env('COOLIFY_VERSION') ?: '4.3.6'")
- ->and($versions['coolify']['v4']['version'])->toBe('4.3.6')
- ->and($versions['coolify']['nightly']['version'])->toBe('4.3.7')
+ ->toContain("'version' => env('COOLIFY_VERSION') ?: '4.3.7'")
+ ->and($versions['coolify']['v4']['version'])->toBe('4.3.7')
+ ->and($versions['coolify']['nightly']['version'])->toBe('4.3.8')
->and($nightlyVersions)->toBe($versions);
});
diff --git a/versions.json b/versions.json
index e32d035c55..2f449eed8c 100644
--- a/versions.json
+++ b/versions.json
@@ -1,10 +1,10 @@
{
"coolify": {
"v4": {
- "version": "4.3.6"
+ "version": "4.3.7"
},
"nightly": {
- "version": "4.3.7"
+ "version": "4.3.8"
},
"helper": {
"version": "1.0.15"