Problem/Motivation
Though it seems like a no-brainer to have the USWDS-specific classes/divs on the Hero region, it's actually problematic. In order to display a proper USWDS "hero callout" component inside that region, some specific markup is required. And in order to change the background image of the div, some custom CSS is required. This is a great opportunity to abstract out all that markup and CSS into a re-usable mechanism, which is what I've done in uswds_paragraphs. However, if the "usa-hero", "usa-section", and "usa-grid" classes are hardcoded onto that region in the page template, the mechanism (a Paragraph type, in the above case) can not be placed anywhere else.
Proposed resolution
Since a proper hero with callout requires custom markup anyway, I propose to remove the USWDS-specific classes/divs from the Hero region in the page template. Any sites that were currently displaying custom blocks in that region and relying on the class can wrap their custom markup in 2 divs (inner div with "usa-grid", outer div with "usa-hero"), to retain current behavior.
Remaining tasks
Write and review patch.
User interface changes
None.
API changes
None.
Data model changes
Hero region no longer automatically gets the usa-section/usa-hero/usa-grid classes.
Comment | File | Size | Author |
---|---|---|---|
#3 | uswds-d8-remove-hero-classes-2895286-3.patch | 417 bytes | brockfanning |
#3 | uswds-d7-remove-hero-classes-2895286-3.patch | 451 bytes | brockfanning |
Comments
Comment #2
brockfanning CreditAttribution: brockfanning commentedComment #3
brockfanning CreditAttribution: brockfanning commentedComment #6
brockfanning CreditAttribution: brockfanning commented