Conversation
… throughout page (#518) * Added an aria-labelledby for the key actions using compHeading.id * Added id to the key-actions.json * Added compHeading.id to the sidebar-heading "Key Agencies" * Removed the aria label from the sidebar-heading * Updated the comp-heading with modifier class --sidebar * Moved the 'after' under the --sidebar & .sidebar * Add modifiers --centered and --sidebar to the comp-header.twig * Moved the sidebar modifier in the comp-heading.twig * Removed the compHeading.id from the key-actions.twig * Removed the center modifiere to h3 header in comp-heading.twig * DP-3232 - Comp Heading - updates * DP-3232 - Comp Heading - reverting level headings * DP-3232 - Key Actions - populating aria-labelled by and removing sidebarheading
jesconstantine
left a comment
There was a problem hiding this comment.
Great work @legostud -- I looooove using the key actions as a callout grid. I know you did a lot of work with a lot of care to make this backwards compatible and I appreciate it!
I just want to confirm my understanding with the questions below. Maybe you can walk me through it during scrum on Monday?
Thanks :)
| <h2 class="ma__action-finder__title"> | ||
| {{ actionFinder.title }} | ||
| </h2> | ||
| {# Backward compatible with 5.7 - replaced h2 with compHeading #} |
|
|
||
| <section class="ma__key-actions"> | ||
| {# fallback to compHeading Id value #} | ||
| {% set keyActionId = keyActions.compHeading.id %} |
There was a problem hiding this comment.
Should we check for keyActions.compHeading.id here first since it's optional?
| <div | ||
| class="ma__key-actions__items" | ||
| {% if keyActionId %} | ||
| aria-labelledby="{{ keyActionId }}" |
There was a problem hiding this comment.
I remember talking about the heading / labelledby id stuff, just want to make sure I understand what's happening here:
When key actions is used as a standalone component, it will generally have a compHeading (visual or semantic) with an id, so that is the default / fallback value of keyActionId -- a variable which refers to the id of the thing that describes it.
When key actions is included as a child component (i.e. actionFinder), it does not need to use its compHeading because the parent component could have its own heading and can therefor pass in an id for that heading as keyActions.id (i.e. keyActions|merge({"id": "all-" ~ actionFinder.id, }). This variable assignment happens after the fallback so it will always take precedent if it exists.
Am I understanding this correctly?
| <div class="ma__key-actions__container"> | ||
| {% if keyActions.compHeading %} | ||
| {% set compHeading = keyActions.compHeading %} | ||
| {% set compHeading = keyActions.compHeading|merge({"id": keyActionId}) %} |
There was a problem hiding this comment.
Can you explain why this is necessary? (I know we talked about it!) If there is a compHeading.id don't we always want to use that? And if there isn't a compHeading.id isn't it likely that the id was passed in because there is a heading in the parent component that is including this whose id is used in aria-labelledby?
There was a problem hiding this comment.
What we want to always use is the keyActions.id value. If that hasn't been passed then we fallback to the compHeading.id. If that hasn't been passed then we fall back to a blank id, because unlabeled is better than mis-labeled.
| {% if actionFinder.featuredHeading %} | ||
| <h3 class="ma__action-finder__category">{{ actionFinder.featuredHeading }}</h3> | ||
| {% endif %} | ||
| <div class="ma__action-finder__items"> |
There was a problem hiding this comment.
I saw the backwards-compatible scss to support this selector - thank you!
| {% endif %} | ||
| {% endfor %} | ||
| <div class="ma__action-finder__all-items"> | ||
| {% set keyActions = { "links": actionFinder.links } %} |
There was a problem hiding this comment.
This ensures that the data structure can stay the same - nice!
| <h3 class="ma__action-finder__category" id="featured-{{ actionFinder.id }}">{{ actionFinder.featuredHeading }}</h3> | ||
| {% set keyActions = keyActions|merge({"id": "featured-" ~ actionFinder.id, }) %} | ||
| {% endif %} | ||
| {% include "@organisms/by-author/key-actions.twig" %} |
There was a problem hiding this comment.
What's the id for keyActions if we don't have a featuredHeading here?
There was a problem hiding this comment.
ah, now I get the other comment. I'll pass the main title's id if we don't have a featured Heading.
| {% endfor %} | ||
| <div class="ma__action-finder__all-items"> | ||
| {% set keyActions = { "links": actionFinder.links } %} | ||
| {% if actionFinder.generalHeading and actionFinder.featuredLinks %} |
There was a problem hiding this comment.
Why wouldn't we display the generalHeading regardless of whether or not there were featuredLinks?
There was a problem hiding this comment.
It was a design decision. Did really make sense to say "All ..." when there aren't "featured" links above it. The heading just adds confusion.
| {{ actionFinder.title }} | ||
| </h2> | ||
| {# Backward compatible with 5.7 - replaced h2 with compHeading #} | ||
| {% set compHeading = actionFinder.compHeading ? : {"title": actionFinder.title, "color":"yellow","id": ""} %} |
There was a problem hiding this comment.
Don't we want the title heading to have an id since that could potentially be passed down to the keyActions aria-labelledby (i.e. in the else clause for the general items)
There was a problem hiding this comment.
The aria-labelledby id would be the sub heading not the this title.
| <h3 class="ma__action-finder__category" id="all-{{ actionFinder.id }}">{{ actionFinder.generalHeading }}</h3> | ||
| {% set keyActions = keyActions|merge({"id": "all-" ~ actionFinder.id, }) %} | ||
| {% else %} | ||
| {% set keyActions = keyActions|merge({"id": actionFinder.id, }) %} |
There was a problem hiding this comment.
This actionFinder.id doesn't currently correspond to a heading, does it?
|
I think I've address all of the issues here. please feel free to review again |
Description
Related Issue / Ticket
https://jira.state.ma.us/browse/DP-5343
Steps to Test
Impacted Areas in Application
idvariable@todo
h3with a restyledComp Headingcontained in the Key Actions pattern