Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Allow section-label heading optionally use a strong element #3574

Closed
1 task done
rhenshaw56 opened this issue Jul 2, 2020 · 8 comments · Fixed by #3585
Closed
1 task done

Allow section-label heading optionally use a strong element #3574

rhenshaw56 opened this issue Jul 2, 2020 · 8 comments · Fixed by #3585
Assignees
Labels
a11y-swarm An a11y swarm (clarify dev or full team in the desc) needs to be carried out before moving to test investigation ws-articles Tasks for the WS Articles Team

Comments

@rhenshaw56
Copy link
Contributor

rhenshaw56 commented Jul 2, 2020

Is your feature request related to a problem? Please describe.

psammead-section-label currently only renders an H2. We need to be able to choose which element is rendered inside to meet a11y requirements. At the moment, this isn't possible using the Styled Components as= prop, because styles are tightly coupled to the nested elements.

Psammead Section Label

Describe the solution you'd like
We could:

  • Pass an as prop value down onto the children components.
  • Make SectionLabel accept children and assign the as prop directly.

Describe alternatives you've considered

  • consider moving all typography, font and style settings from plain title to the top level h2 that way we don't use lose those if it's overridden with the "as" prop.

  • consider if we should override the entire section-label in simorgh for our use case.

Testing notes
Add snapshot tests demonstrating the function.

Dev insight: Will there be any potential regression? etc

  • confirm with @greenc05 if we have some other place where section-label uses a strong element and why we need to do that here.

  • see where the section label is being used and consider if we could dry up the logic in the section-label component to distinguish if we render a link or plain title.

  • This feature is expected to need manual testing.

@rhenshaw56 rhenshaw56 added Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. ws-articles Tasks for the WS Articles Team labels Jul 2, 2020
@HarveyPeachey HarveyPeachey added this to the [WSS] STY Batch 6 milestone Jul 6, 2020
@rhenshaw56 rhenshaw56 added investigation and removed Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. labels Jul 6, 2020
@greenc05 greenc05 added the a11y-swarm An a11y swarm (clarify dev or full team in the desc) needs to be carried out before moving to test label Jul 6, 2020
@greenc05
Copy link
Contributor

greenc05 commented Jul 6, 2020

I don't believe we have designs for this to be a link? "see where the section label is being used and consider if we could dry up the logic in the section-label component to distinguish if we render a link or plain title."

@greenc05
Copy link
Contributor

greenc05 commented Jul 6, 2020

"confirm with @greenc05 if we have some other place where section-label uses a strong element and why we need to do that here." We only use the 'section-label' component on index pages, h2's are apporpriate for a index page. A h2 is not appropriate for the recommendations component, as this is to be used on story pages within the story body. Users don't expect headings within the story body that aren't related to the story, and also any content below this component would sit under this heading if one was used for it, which would not be correct. Therefore a strong element should be used in this situation. Note that the recommendations component should also not have a 'see all' link as section-label can do, are we sure that repurposing the 'section-label' is the right way to go here?

@rhenshaw56 rhenshaw56 self-assigned this Jul 7, 2020
@rhenshaw56
Copy link
Contributor Author

A h2 is not appropriate for the recommendations component, as this is to be used on story pages within the story body. Users don't expect headings within the story body that aren't related to the story, and also any content below this component would sit under this heading if one was used for it, which would not be correct. Therefore a strong element should be used in this situation

Thanks for clarifying @greenc05, this makes sense now.

Since we now have a requirement to use section labels in the main story body, would it be worth adding support to export a StrongTitle that uses a strong element instead of totally re-purposing the section-label ?

@greenc05
Copy link
Contributor

greenc05 commented Jul 7, 2020

I don't think we should be re-purposing the 'section label' that is used on index pages, it's too different. Is 'section-label' actualy in storybook? I can't see it...

@rhenshaw56
Copy link
Contributor Author

@greenc05 here it is

@greenc05
Copy link
Contributor

greenc05 commented Jul 7, 2020

Ok so it's not that different.... we wouldn't need it 'with a link' or 'bar' and there are a few extra spans that we don't need but I guess you could use it... could just call it 'strong'? instead of 'default'?

@rhenshaw56
Copy link
Contributor Author

Thanks @greenc05. Are/Would there be cases where we might have links using strong elements ?

@greenc05
Copy link
Contributor

greenc05 commented Jul 7, 2020

It's possible that a strong element could also be a link, though we don't have a requirement for that, that I have seen.... The 'with a link' adds a 'see more' link currently - it's not just making the h2/strong element a link...

@rhenshaw56 rhenshaw56 changed the title Allow section-label plain title optionally use a strong element Allow section-label heading optionally use a strong element Jul 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y-swarm An a11y swarm (clarify dev or full team in the desc) needs to be carried out before moving to test investigation ws-articles Tasks for the WS Articles Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants