Let a card's title take the heading level the page needs
<x-card> always titled itself with an <h3>, so a card straight under a page's <h1> skipped a level, which SealShare's download page did with no way round it from the application. `heading` takes h2 to h6, or div or p for a title that is not a heading, as <x-pane> and <x-app-bar> already do; h3 stays the default. The skill also says a card holds one subject, as M3 does (plan step 46). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d557dd9b49
commit
ff5349759b
@@ -5,7 +5,9 @@
|
||||
`elevated` (surface-container-low at elevation 1) and `outlined` (surface, an outline-variant
|
||||
edge); all with a medium corner. maryUI's props keep their meaning: `title`, `subtitle`,
|
||||
`separator` (a divider under the header), and the `menu` (top-end, beside the title),
|
||||
`figure` (full-bleed media on top) and `actions` (end-aligned, under the content) slots.
|
||||
`figure` (full-bleed media on top) and `actions` (end-aligned, under the content) slots. The title
|
||||
is an `<h3>` unless `heading` names the level the page's outline needs (`h2` … `h6`, or `div`/`p`
|
||||
for a title that is not a heading), so a card straight under a page's `<h1>` skips no level.
|
||||
|
||||
M3 draws two kinds of card a person can press, and they differ in the keyboard: on a
|
||||
**non-actionable card with actionable elements** Tab moves through each control inside before
|
||||
@@ -51,12 +53,14 @@
|
||||
'title' => null,
|
||||
'subtitle' => null,
|
||||
'variant' => 'filled',
|
||||
'heading' => 'h3',
|
||||
'separator' => false,
|
||||
'actionable' => false,
|
||||
])
|
||||
|
||||
@php
|
||||
$variant = in_array($variant, ['filled', 'elevated', 'outlined'], true) ? $variant : 'filled';
|
||||
$heading = in_array($heading, ['h2', 'h3', 'h4', 'h5', 'h6', 'div', 'p'], true) ? $heading : 'h3';
|
||||
$role = $actionable ? ($attributes->get('role') ?: 'button') : null;
|
||||
$isRow = $actionable || $attributes->has('data-md-list-row');
|
||||
|
||||
@@ -87,7 +91,7 @@
|
||||
<div data-md-card-header-row>
|
||||
<div data-md-card-heading>
|
||||
@if ($title)
|
||||
<h3 data-md-card-title>{{ $title }}</h3>
|
||||
<{{ $heading }} data-md-card-title>{{ $title }}</{{ $heading }}>
|
||||
@endif
|
||||
|
||||
@if ($subtitle)
|
||||
|
||||
Reference in New Issue
Block a user