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

Allow setting visually hidden text for change links in summary lists #165

Closed
paulrobertlloyd opened this issue May 24, 2021 · 1 comment
Closed
Milestone

Comments

@paulrobertlloyd
Copy link
Contributor

paulrobertlloyd commented May 24, 2021

Typically, the ‘Change’ link in a summary list is composed of 2 parts: the visible link (usually labelled ‘Change’), and a visually hidden part, which helps tell change links apart when a screen reader announces them.

Currently, the action param for a row in GovukComponent::SummaryList is pretty dumb; it’ll take anything. However, given this link pattern is so intrinsic to this component, it’d be much more helpful if this component enabled setting these values.

How about, in addition to taking any value as it does currently:

<%= component.slot(
    :row,
    key: 'Name',
    value: 'Aardvark',
    action: link_to('Change', '#aardvark')
) %>

you can supply an object with the following values instead:

<%= component.slot(
    :row,
    key: 'Name',
    value: 'Aardvark',
    action: {
        href: "#aardvark",             # Required
        text: "Change",                # Required, defaults to ‘Change’ if not provided 
        visually_hidden_text: "name",  # Required, but maybe defaults to lowercased `key` value? 
        classes: "",                   # Optional
        html_attributes: {},           # Optional
    }
) %>

Something like that.

@peteryates peteryates added this to the Version 2.0.0 milestone May 25, 2021
@peteryates
Copy link
Member

Excellent suggestion, totally on board with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants