CornellCustomDev / cwd_base

A lightweight Drupal 8+ theme, implementing Cornell Branding and standard CWD components.
1 stars 2 forks source link

WA - Remove <header> and <footer> tags from views-view.html.twig #79

Open sg667 opened 7 months ago

sg667 commented 7 months ago

On lines 52-56 and 78-82 of views-view.html.twig, the header and footer of a view has a <header> and <footer> tag appended. This should be removed and reverted to a <div> tag (or base Drupal markup). This is injecting a lot of misleading landmarks in code.

alisonjo315 commented 7 months ago

I see header/footer tags in the core views-view.html.twig template file, too -- or maybe I'm looking at something different from what you're looking at? https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/views/templates/views-view.html.twig?ref_type=heads

(To be fair, we don't use view headers/footers super often -- or, more accurately, I don't use them or see them used super often. Could you add an example link showing where we're using headers/footers and the resulting markup is problematic?)

sg667 commented 7 months ago

I added an example to a multidev https://dev-roald-hoffmann.pantheonsite.io/books/Other%20Books

It's not only adding the <header> tag, but it's also injecting aria-labels which appear to be static values. I also must have been checking the wrong source when I was checking core files, because the file I saw had <div> tags in place of the <header> and <footer> tags which is probably more appropriate overall.

I guess it could be resolved with overrides on our end when needed given it's a part of Drupal core on a case-by-case basis but given our use cases, I think it would make more sense to default to <header> and <footer> having no semantic role.

With that in mind, if we want to ensure compatibility if we opt to fix this, I would suggest stripping the aria-label and setting role="none" or role="presentation" to it.