Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary list: Allow customisation of full action link content #2649

Open
3 tasks
querkmachine opened this issue May 27, 2022 · 1 comment
Open
3 tasks

Summary list: Allow customisation of full action link content #2649

querkmachine opened this issue May 27, 2022 · 1 comment
Labels
🕔 hours A well understood issue which we expect to take less than a day to resolve. localisation nunjucks summary list

Comments

@querkmachine
Copy link
Member

querkmachine commented May 27, 2022

What

Currently, action links in the Summary list have a hardcoded content order of the action name (html or text), followed by an area of visually hidden text (visuallyHiddenText). The visually hidden text includes a hardcoded space separating it from the prior text, and is usually the same or similar to the key for the current row. For example:

change<span class="govuk-visually-hidden"> name</span>
delete<span class="govuk-visually-hidden"> address</span>

Why

This fixed ordering doesn't accommodate localisation into languages where this text appears in a different order. For example, in German we might have this:

<span class="govuk-visually-hidden">Namen </span>ändern
<span class="govuk-visually-hidden">Adresse </span>löschen

Having a hardcoded space is also undesirable in certain languages, such as Chinese:

更换<span class="govuk-visually-hidden">名字</span>
删除<span class="govuk-visually-hidden">名称</span>

Although it is currently possible for services to pass HTML into the action links and ignore the visuallyHiddenText parameter completely, we may want to investigate methods of either making visuallyHiddenText work with other languages, or removing the use of a dedicated/hardcoded parameter in favour of using the html parameter.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Investigate ways that visuallyHiddenText could work with non-English languages.
  • Make changes to the Nunjucks template and related tests, if we decide to make modifications.
  • Document any changes to Nunjucks parameters.
@querkmachine querkmachine added 🕔 hours A well understood issue which we expect to take less than a day to resolve. nunjucks summary list localisation labels May 27, 2022
@querkmachine
Copy link
Member Author

querkmachine commented Jun 29, 2022

Note: It is already possible to do this by manually specifying the visually-hidden text in the Nunjucks html paramenter and setting visuallyHiddenText to an empty string.

For example:

{{ govukSummaryList({
  rows: [
    {
      key: {
        text: "Namen"
      },
      value: {
        text: "Norman Nescio"
      },
      actions: [
        {
          visuallyHiddenText: '',
          html: '<span class="govuk-visually-hidden">Namen </span>ändern'
        }
      ]
    }
  ]
}) }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕔 hours A well understood issue which we expect to take less than a day to resolve. localisation nunjucks summary list
Projects
None yet
Development

No branches or pull requests

1 participant