Skip to content

1161: Views Block Rework - #466

Open
dblanken-yale wants to merge 10 commits into
developfrom
1318-views-rework
Open

1161: Views Block Rework#466
dblanken-yale wants to merge 10 commits into
developfrom
1318-views-rework

Conversation

@dblanken-yale

Copy link
Copy Markdown
Contributor

1161: Views Block Architectural Rework

Companion theme PR addressing a QA accessibility finding on the views/listing block rework (yalesites-org/yalesites-project#1299).

Description of work

  • Set the listing card heading level to h2 in the post, event, page, and profile card view-mode templates (reference_card__heading_level: '2'), matching the existing node--view--taxonomy-term.html.twig pattern.

  • Fixes the axe heading-order (skipped heading level) violation QA flagged on the first card of a listing: when a listing block has no heading, the component-wrapper renders no h2, so the cards previously followed the page h1 directly and jumped to h3. The level only changes the heading tag — visual size comes from BEM modifier classes, so appearance is unchanged.

  • Other work completed in: 1161: Views rework yalesites-project#1299, 1161: Views Block Rework component-library-twig#649

Functional testing steps:

  • Place a listing block (e.g. Events - Card Grid) with no block heading; confirm the first card title renders h2 directly under the page h1 (no skipped level in axe).
  • Place a listing block with a block heading; confirm the outline reads h2 (block) then h2 (cards) with no skipped level.
  • Confirm the card title visual size is unchanged.

References yalesites-org/YaleSites-Internal#1161

The post/event/page/profile card templates did not pass
reference_card__heading_level, so reference-card defaulted the title to h3.
When a listing block has no heading the component-wrapper renders no h2, so
the cards followed the page h1 directly and skipped from h1 to h3 -- an axe
heading-order (skipped heading level) violation QA flagged on the first event
card of a listing.

Pass reference_card__heading_level: '2' from the four listing card templates,
matching node--view--taxonomy-term.html.twig. The level only sets the heading
tag (visual size comes from BEM modifier classes, unchanged), so this fixes the
outline without altering appearance: a headingless listing now renders h1 -> h2,
and a listing with a block heading renders h2 -> h2 (flat, but not a skip).

Refs #1161
Follow-up to hardcoding listing card headings at H2: the correct level depends
on whether the listing block renders its own heading. Read the per-result
node.card_heading_level stamped by ys_views_basic instead of a fixed level, so
cards nest at H3 under a block heading and sit at H2 when the block has none.
Each template keeps its prior default (card H2; list/condensed/directory H3) as
the fallback for non-listing renders, which never set the property.

Refs #1161
Supports auto-running the scaffold listing filters (paired with the config
change that enables Better Exposed Filters autosubmit on the scaffold views).

- Add the WCAG 2.1 SC 3.2.2 advisory note to the exposed-filter form template
  so users are told up front that results update on their own, keeping the
  auto-submit from being an unexpected change of context.
- Announce the updated result count to assistive technology after each filter
  update via Drupal.announce (SC 4.1.3), skipping the initial page render.
  atomic_preprocess_views_view() passes the count per view DOM id; a small
  behavior reads it and announces on filter-driven updates only.

References yalesites-org/YaleSites-Internal#1367
The visible "Results update automatically as you make selections." note is no
longer wanted (QA): auto-submit is already conveyed to assistive tech by the
polite aria-live result-count announcement (views-basic-filter-status.js), so
the persistent visible note is redundant. Remove it from the scaffold exposed
form; the screen-reader announcement stays.

Refs #1367
Core's Views AJAX adds a ScrollTopCommand whenever the request carries a
pager_element, which the Views AJAX settings always include — so the
scroll-to-top fired on every exposed-filter auto-submit, not just pager clicks,
yanking the page down while typing in a listing filter (#1299 QA).

Add a small theme behavior that wraps the `scrollTop` AJAX command and skips it
only when the request came from a listing exposed-filter form (identified by the
form's data-drupal-target-view dom id being a key in the existing
ysViewsBasicFilter registry). Pagers and every other caller keep the default
scroll. Attached only for the scaffold listing views.

Refs #1299
@dblanken-yale dblanken-yale self-assigned this Jul 29, 2026
@dblanken-yale dblanken-yale changed the title 1161: Set listing card headings to h2 (a11y heading order) 1161: Views Block Rework Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant