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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(ui): improve tooltip a11y and settings select layout
Andras Bacsai232b999cc95c
diff --git a/resources/css/app.css b/resources/css/app.cssindex a0b80d1950..826e5470a0 100644--- a/resources/css/app.css+++ b/resources/css/app.css@@ -1174,6 +1174,20 @@ body.terminal-is-fullscreen .terminal-fullscreen-shell [data-terminal-mobile-toobox-shadow: none !important;}+/* Reserve the trailing area used by the native select chevron. */+.application-settings-workspace .select,+.application-settings-form .select {+ padding-right: 2.5rem;+}++@media (max-width: 767px) {+ .application-settings-workspace .select,+ .application-settings-form .select {+ font-size: 0.75rem !important;+ line-height: 1.25rem;+ }+}+/* Keep password toggle / copy button clear of the value inside denser settings inputs */.application-settings-workspace .input.input-with-password-toggle,.application-settings-workspace .input[type="password"],diff --git a/resources/views/components/forms/button.blade.php b/resources/views/components/forms/button.blade.phpindex e57757b329..86423eb9df 100644--- a/resources/views/components/forms/button.blade.php+++ b/resources/views/components/forms/button.blade.php@@ -26,26 +26,45 @@@endphp@if ($authDisabled || filled($tooltip))<span class="relative inline-flex"- x-data="{ visible: false, _t: null }"- @mouseenter="_t = setTimeout(() => {- visible = true;- $nextTick(() => requestAnimationFrame(() => {- const tip = $refs.tip;- if (!tip) return;- const r = $el.getBoundingClientRect();- const t = tip.getBoundingClientRect();- let top = r.top - t.height - 6;- let left = r.left;- if (top < 4) top = r.bottom + 6;- if (left + t.width > innerWidth - 8) left = innerWidth - 8 - t.width;- if (left < 4) left = 4;- tip.style.top = top + 'px';- tip.style.left = left + 'px';- }));- }, 300)"- @mouseleave="clearTimeout(_t); visible = false">+ x-data="{+ visible: false,+ _t: null,+ showTooltip(delay = 0) {+ clearTimeout(this._t);+ this._t = setTimeout(() => {+ this.visible = true;+ this.positionTooltip();+ }, delay);+ },+ hideTooltip() {+ clearTimeout(this._t);+ this.visible = false;+ },+ positionTooltip() {+ this.$nextTick(() => requestAnimationFrame(() => {+ const tip = this.$refs.tip;+ if (!tip) return;+ const r = this.$el.getBoundingClientRect();+ const t = tip.getBoundingClientRect();+ let top = r.top - t.height - 6;+ let left = r.left;+ if (top < 4) top = r.bottom + 6;+ if (left + t.width > innerWidth - 8) left = innerWidth - 8 - t.width;+ if (left < 4) left = 4;+ tip.style.top = top + 'px';+ tip.style.left = left + 'px';+ }));+ }+ }"+ @if ($disabled) tabindex="0" :aria-describedby="visible ? $id('button-tooltip') : null" @endif+ @mouseenter="showTooltip(300)"+ @mouseleave="hideTooltip()"+ @focusin="showTooltip()"+ @focusout="hideTooltip()"+ @click.outside="hideTooltip()">@endif<button @disabled($disabled) @if ($isHighlighted) isHighlighted @endif+ @if ($authDisabled || filled($tooltip)) :aria-describedby="visible ? $id('button-tooltip') : null" @endif{{ $attributes->merge(['class' => $defaultClass, 'type' => 'button'])->merge($loadingAttributes) }}@isset($confirm)x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"@@ -60,7 +79,8 @@{{ $slot }}</button>@if ($authDisabled || filled($tooltip))- <div x-ref="tip" x-show="visible" x-cloak class="auth-tooltip">+ <div x-ref="tip" x-show="visible" x-cloak :id="$id('button-tooltip')" role="tooltip"+ class="auth-tooltip">{{ $tooltip ?: 'You do not have permission to perform this action.' }}</div></span>diff --git a/resources/views/components/helper.blade.php b/resources/views/components/helper.blade.phpindex 79870196aa..1f0581b8c0 100644--- a/resources/views/components/helper.blade.php+++ b/resources/views/components/helper.blade.php@@ -33,6 +33,21 @@this.pinned = false;this.open = false;},+ closeWhenFocusLeaves() {+ this.$nextTick(() => {+ const activeElement = document.activeElement;+ if (!this.$refs.trigger?.contains(activeElement) && !this.$refs.popup?.contains(activeElement)) {+ this.close();+ }+ });+ },+ closeWhenPointerIsOutside(event) {+ if (!this.open || this.$refs.trigger?.contains(event.target) || this.$refs.popup?.contains(event.target)) {+ return;+ }++ this.close();+ },position() {const trigger = this.$refs.trigger;const popup = this.$refs.popup;@@ -56,7 +71,8 @@this.style = `top: ${top}px; left: ${left}px;`;}-}" @click.outside="close" @keydown.window.escape="close" @resize.window="open && position()" @scroll.window="open && position()"+}" @pointerdown.window="closeWhenPointerIsOutside($event)" @keydown.window.escape="close"+ @resize.window="open && position()" @scroll.window="open && position()"{{ $attributes->merge(['class' => 'relative z-10 inline-block align-middle']) }}>{{-- button (not div) so label-for associations do not steal the click on mobile --}}<button type="button" x-ref="trigger"@@ -64,7 +80,8 @@'info-helper relative z-10 inline-flex shrink-0 items-center justify-center border-0 bg-transparent p-0 leading-none','size-3.5' => ! isset($trigger),])- aria-label="{{ $label }}" @mouseenter="show(false)" @mouseleave="hide"+ aria-label="{{ $label }}" :aria-describedby="open ? $id('helper-popup') : null"+ @mouseenter="show(false)" @mouseleave="hide" @focus="show(false)" @blur="closeWhenFocusLeaves()"@click.prevent.stop="open && pinned ? close() : show(true)">@isset($trigger){{ $trigger }}@@ -77,7 +94,7 @@@endisset</button><template x-teleport="body">- <div x-ref="popup" x-show="open" x-cloak+ <div x-ref="popup" x-show="open" x-cloak :id="$id('helper-popup')" role="tooltip"x-transition:enter="transition ease-out duration-100"x-transition:enter-start="opacity-0 translate-y-0.5"x-transition:enter-end="opacity-100 translate-y-0"@@ -86,7 +103,7 @@x-transition:leave-end="opacity-0":style="style"class="info-helper-popup fixed z-[9999] w-max max-w-[min(20rem,calc(100vw-2rem))]"- @mouseenter="cancelHide()" @mouseleave="hide()" @click.stop>+ @mouseenter="cancelHide()" @mouseleave="hide()" @focusout="closeWhenFocusLeaves()" @click.stop><div class="px-3 py-2.5 text-[13px] leading-5">{!! $helper !!}</div>diff --git a/resources/views/livewire/project/service/domains.blade.php b/resources/views/livewire/project/service/domains.blade.phpindex d1eeac8704..87804ce1af 100644--- a/resources/views/livewire/project/service/domains.blade.php+++ b/resources/views/livewire/project/service/domains.blade.php@@ -176,7 +176,8 @@</div>@else{{-- Flat table with Service column so assignment is always visible --}}- <div class="application-settings-section-body is-flush mt-1 w-full scroll-mt-28">+ <div wire:key="service-domains-list-{{ md5(serialize($domainRows)) }}"+ class="application-settings-section-body is-flush mt-1 w-full scroll-mt-28">@include('livewire.project.service.partials.domain-table', ['rows' => collect($domainRows),'domainRows' => $domainRows,diff --git a/resources/views/livewire/project/shared/cloudflare-autoconfigure.blade.php b/resources/views/livewire/project/shared/cloudflare-autoconfigure.blade.phpindex a17c641a23..499ffc54e5 100644--- a/resources/views/livewire/project/shared/cloudflare-autoconfigure.blade.php+++ b/resources/views/livewire/project/shared/cloudflare-autoconfigure.blade.php@@ -8,7 +8,9 @@x-bind:aria-expanded="dnsEntriesOpen" title="DNS entries for this server"><x-reicon name="globe" class="size-3.5" />DNS entries- <x-reicon name="chevron-down" class="size-3 opacity-55" />+ <span class="inline-flex transition-transform" :class="dnsEntriesOpen && 'rotate-180'">+ <x-reicon name="chevron-down" class="size-3 opacity-55" />+ </span></button><div x-show="dnsEntriesOpen" x-cloak role="menu" x-transition.origin.top.rightclass="listbox-panel left-auto! right-0! z-[90]! w-56! min-w-56!">diff --git a/tests/Feature/HelperInfoButtonTest.php b/tests/Feature/HelperInfoButtonTest.phpindex a51d525868..fe684e36e5 100644--- a/tests/Feature/HelperInfoButtonTest.php+++ b/tests/Feature/HelperInfoButtonTest.php@@ -44,6 +44,39 @@ test('helper popup remains open while moving from the trigger into interactive c->toContain('@mouseleave="hide()"');});+test('helper popup supports focus dismissal and tooltip aria relationships', function () {+ $helper = file_get_contents(resource_path('views/components/helper.blade.php'));++ expect($helper)+ ->toContain('closeWhenFocusLeaves()')+ ->toContain('@focus="show(false)"')+ ->toContain('@blur="closeWhenFocusLeaves()"')+ ->toContain('role="tooltip"')+ ->toContain(':aria-describedby="open ? $id(\'helper-popup\') : null"')+ ->toContain(':id="$id(\'helper-popup\')"');+});++test('teleported helper popup closes from taps outside on mobile', function () {+ $helper = file_get_contents(resource_path('views/components/helper.blade.php'));++ expect($helper)+ ->toContain('@pointerdown.window="closeWhenPointerIsOutside($event)"')+ ->toContain('closeWhenPointerIsOutside(event)')+ ->toContain('this.$refs.popup?.contains(event.target)');+});++test('button tooltips are available to keyboard and assistive technology users', function () {+ $button = file_get_contents(resource_path('views/components/forms/button.blade.php'));++ expect($button)+ ->toContain('@focusin="showTooltip()"')+ ->toContain('@focusout="hideTooltip()"')+ ->toContain('@click.outside="hideTooltip()"')+ ->toContain('role="tooltip"')+ ->toContain(':aria-describedby="visible ? $id(\'button-tooltip\') : null"')+ ->toContain(':id="$id(\'button-tooltip\')"');+});+test('listbox keeps the helper outside the label association', function () {$path = resource_path('views/components/forms/listbox.blade.php');$contents = file_get_contents($path);diff --git a/tests/Feature/SelectControlStyleTest.php b/tests/Feature/SelectControlStyleTest.phpnew file mode 100644index 0000000000..1bd3d6f0fd--- /dev/null+++ b/tests/Feature/SelectControlStyleTest.php@@ -0,0 +1,9 @@+<?php++test('native select values stay clear of the dropdown icon on mobile', function () {+ $styles = file_get_contents(resource_path('css/app.css'));++ expect($styles)+ ->toMatch('/\.application-settings-workspace \.select,\s*\.application-settings-form \.select \{\s*padding-right: 2\.5rem;/')+ ->toMatch('/@media \(max-width: 767px\) \{\s*\.application-settings-workspace \.select,\s*\.application-settings-form \.select \{\s*font-size: 0\.75rem !important;/');+});diff --git a/tests/Feature/ServiceDomainsTest.php b/tests/Feature/ServiceDomainsTest.phpindex 548936d98a..c06b297430 100644--- a/tests/Feature/ServiceDomainsTest.php+++ b/tests/Feature/ServiceDomainsTest.php@@ -105,6 +105,14 @@ it('shows dns entries control next to Add', function () {->assertSee('Manual records');});+it('rotates the dns entries chevron while its dropdown is open', function () {+ $view = file_get_contents(resource_path('views/livewire/project/shared/cloudflare-autoconfigure.blade.php'));++ expect($view)+ ->toContain('class="inline-flex transition-transform"')+ ->toContain(':class="dnsEntriesOpen && \'rotate-180\'"');+});+it('lists dns entries for service hosts that still need dns', function () {$this->webApp->update(['fqdn' => 'https://web.example.com',@@ -199,7 +207,9 @@ it('adds a domain to a selected service application', function () {->set('newDomain', 'https://web.example.com')->call('addDomain')->assertHasNoErrors()- ->assertDispatched('success');+ ->assertDispatched('success')+ ->assertSet('domainRows', fn (array $rows): bool => collect($rows)->pluck('url')->contains('https://web.example.com'))+ ->assertSee('https://web.example.com');$this->webApp->refresh();expect(explode(',', (string) $this->webApp->fqdn))@@ -216,6 +226,12 @@ it('adds a domain to a selected service application', function () {->not->toBeNull();});+it('replaces the rendered domain list when its rows change', function () {+ $view = file_get_contents(resource_path('views/livewire/project/service/domains.blade.php'));++ expect($view)->toContain('wire:key="service-domains-list-{{ md5(serialize($domainRows)) }}"');+});+it('does not duplicate the service name as a badge in the domain cell', function () {$view = file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php'));