fix(ui): gate copy button on clipboard API support

Only show the copy control when isSecureContext and clipboard.writeText
are available, and style the empty internal hostname state as a readonly
input to match adjacent fields.
This commit is contained in:
Andras Bacsai
2026-08-06 13:58:33 +02:00
parent 9fd2a21f24
commit a6ab360ac2
4 changed files with 15 additions and 9 deletions
@@ -14,6 +14,7 @@ it('shows internal Docker access details in application general settings', funct
->toContain('Network aliases')
->toContain('wire:init="loadCurrentInternalHostname"')
->toContain('$currentInternalHostname')
->toContain('class="input input-with-copy-button bg-white dark:bg-coolgray-100 dark:read-only:bg-coolgray-100 dark:read-only:text-white"')
->not->toContain('Changes with each deployment')
->toContain("window.scrollToSettingsSection?.('networking-section')")
->and($generalComponent)
@@ -38,7 +38,9 @@ it('renders copy fields as visible readonly controls with an accessible copy act
expect($html)
->toContain('label class="flex gap-1 items-center mb-1 text-sm font-medium text-black dark:text-white"')
->toContain('readonly')
->toContain('input-with-copy-button')
->toContain("canCopy: window.isSecureContext && typeof navigator.clipboard?.writeText === 'function'")
->toContain("x-bind:class=\"{ 'input-with-copy-button': canCopy }\"")
->toContain('x-show="canCopy"')
->toContain('copy-button')
->toContain('aria-label="Copy to clipboard"')
->toContain('title="Copy to clipboard"')