From 9d5644b3995b68f9d14b60620e3584804136e224 Mon Sep 17 00:00:00 2001 From: Istvan Soos Date: Mon, 20 Jan 2025 15:49:28 +0100 Subject: [PATCH] Fix h3 issue on landing page. --- .../frontend/templates/views/landing/mini_list.dart | 13 +++++++++++-- app/test/frontend/golden/landing_page.html | 6 +++--- .../lib/validation/html/html_validation.dart | 2 +- pkg/web_css/lib/src/_home.scss | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/lib/frontend/templates/views/landing/mini_list.dart b/app/lib/frontend/templates/views/landing/mini_list.dart index 86778c5f7a..a739ecee44 100644 --- a/app/lib/frontend/templates/views/landing/mini_list.dart +++ b/app/lib/frontend/templates/views/landing/mini_list.dart @@ -27,8 +27,17 @@ d.Node _title(String sectionTag, PackageView p) { return d.a( classes: ['mini-list-item-title'], href: urls.pkgPageUrl(p.name), - attributes: {'data-ga-click-event': 'landing-$sectionTag-card-title'}, - child: d.h3(text: p.name), + attributes: { + 'data-ga-click-event': 'landing-$sectionTag-card-title', + }, + child: d.span( + classes: ['mini-list-item-title-text'], + text: p.name, + attributes: { + 'role': 'heading', + 'aria-level': '2', + }, + ), ); } diff --git a/app/test/frontend/golden/landing_page.html b/app/test/frontend/golden/landing_page.html index c4a31b37bf..dddc4c3f4d 100644 --- a/app/test/frontend/golden/landing_page.html +++ b/app/test/frontend/golden/landing_page.html @@ -130,7 +130,7 @@

Flutter Favorites

-

flutter_titanium

+ flutter_titanium

flutter_titanium is awesome

@@ -153,7 +153,7 @@

Most popular packages

-

neon

+ neon

neon is awesome

@@ -167,7 +167,7 @@

neon

-

oxygen

+ oxygen

oxygen is awesome

diff --git a/pkg/_pub_shared/lib/validation/html/html_validation.dart b/pkg/_pub_shared/lib/validation/html/html_validation.dart index 8a4237f246..73f685653e 100644 --- a/pkg/_pub_shared/lib/validation/html/html_validation.dart +++ b/pkg/_pub_shared/lib/validation/html/html_validation.dart @@ -178,7 +178,7 @@ void validateHtml(Node root) { } // "role"="" attributes should be on interactive components - final allowedForRole = {'a', 'form'}; + final allowedForRole = {'a', 'form', 'span'}; for (final elem in querySelectorAll('[role]')) { final tag = elem.localName!; final role = elem.attributes['role']; diff --git a/pkg/web_css/lib/src/_home.scss b/pkg/web_css/lib/src/_home.scss index 8f9e8a9f9d..3585ec3313 100644 --- a/pkg/web_css/lib/src/_home.scss +++ b/pkg/web_css/lib/src/_home.scss @@ -127,7 +127,8 @@ } .mini-list-item-title { - > h3 { + > .mini-list-item-title-text { + display: block; color: var(--pub-home_card_title-text-color); font-size: 20px; // Needs to be slightly more than 1.2, otherwise the bottom