Keep a full-screen dialog's subtitle on a phone
tests / lint (push) Successful in 1m20s
tests / feature (8.4) (push) Successful in 1m13s
tests / feature (8.5) (push) Successful in 1m13s
tests / browser (chrome, chromium) (push) Successful in 3m17s
tests / browser (firefox, firefox) (push) Successful in 4m37s
tests / browser (safari, webkit) (push) Successful in 5m10s
tests / lint (push) Successful in 1m20s
tests / feature (8.4) (push) Successful in 1m13s
tests / feature (8.5) (push) Successful in 1m13s
tests / browser (chrome, chromium) (push) Successful in 3m17s
tests / browser (firefox, firefox) (push) Successful in 4m37s
tests / browser (safari, webkit) (push) Successful in 5m10s
The bar names the dialog there, so only the headline hides; the subtitle used to disappear with it, and a subtitle without a title never showed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
co-authored by
Claude Opus 5
parent
648a4cfe0f
commit
cb3aa798a0
@@ -78,18 +78,19 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div @class(['min-h-0 flex-1', 'max-sm:overflow-y-auto max-sm:px-6 max-sm:pb-6' => $fullscreen])>
|
<div @class(['min-h-0 flex-1', 'max-sm:overflow-y-auto max-sm:px-6 max-sm:pb-6' => $fullscreen])>
|
||||||
@if (filled($title) || $icon)
|
@if (filled($title) || filled($subtitle) || $icon)
|
||||||
<div @class(['mb-4', 'max-sm:hidden' => $fullscreen && ! $icon, 'text-center' => $icon])>
|
{{-- A full-screen dialog's bar names it on a phone, so only the subtitle stays there. --}}
|
||||||
|
<div @class(['mb-4', 'max-sm:hidden' => $fullscreen && ! $icon && blank($subtitle), 'text-center' => $icon])>
|
||||||
@if ($icon)
|
@if ($icon)
|
||||||
<x-livewire-material::icon :name="$icon" class="mx-auto mb-4 size-6 text-secondary" />
|
<x-livewire-material::icon :name="$icon" class="mx-auto mb-4 size-6 text-secondary" />
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (filled($title))
|
@if (filled($title))
|
||||||
<h2 id="{{ $id }}-title" class="type-headline-sm">{{ $title }}</h2>
|
<h2 id="{{ $id }}-title" @class(['type-headline-sm', 'max-sm:hidden' => $fullscreen && ! $icon])>{{ $title }}</h2>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (filled($subtitle))
|
@if (filled($subtitle))
|
||||||
<p class="mt-4 type-body-md text-on-surface-variant">{{ $subtitle }}</p>
|
<p @class(['type-body-md text-on-surface-variant', 'mt-4' => filled($title) || $icon, 'max-sm:mt-0' => $fullscreen && ! $icon])>{{ $subtitle }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($separator)
|
@if ($separator)
|
||||||
|
|||||||
@@ -44,6 +44,17 @@ it('uses the surrounding Alpine scope without wire:model, and stays open when pe
|
|||||||
->toContain('aria-label="Close"');
|
->toContain('aria-label="Close"');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps a full-screen dialog\'s subtitle on a phone, where its bar carries the title', function () {
|
||||||
|
$html = (string) $this->blade('<x-modal title="Enable 2FA" subtitle="Scan the code" fullscreen>Text</x-modal>');
|
||||||
|
|
||||||
|
expect($html)
|
||||||
|
->toMatch('/<h2 id="[^"]+-title" class="type-headline-sm max-sm:hidden">/')
|
||||||
|
->toContain('<p class="type-body-md text-on-surface-variant mt-4 max-sm:mt-0">Scan the code</p>')
|
||||||
|
->not->toContain('<div class="mb-4 max-sm:hidden">')
|
||||||
|
->and((string) $this->blade('<x-modal title="Help" fullscreen>Text</x-modal>'))->toContain('<div class="mb-4 max-sm:hidden">')
|
||||||
|
->and((string) $this->blade('<x-modal subtitle="Only a subtitle">Text</x-modal>'))->toContain('<p class="type-body-md text-on-surface-variant">Only a subtitle</p>');
|
||||||
|
});
|
||||||
|
|
||||||
it('slides a side sheet in from either edge, and is a pane from xl when asked', function () {
|
it('slides a side sheet in from either edge, and is a pane from xl when asked', function () {
|
||||||
expect((string) $this->blade('<x-drawer title="Details" with-close-button>Body</x-drawer>'))
|
expect((string) $this->blade('<x-drawer title="Details" with-close-button>Body</x-drawer>'))
|
||||||
->toContain('x-trap.inert.noscroll="open && ! wide"')
|
->toContain('x-trap.inert.noscroll="open && ! wide"')
|
||||||
|
|||||||
Reference in New Issue
Block a user