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

govukDateInput not allowing "attribute" property to change for fieldset option #1478

Closed
andrew-mcgregor opened this issue Jul 3, 2019 · 0 comments · Fixed by #1541
Closed

Comments

@andrew-mcgregor
Copy link

Hi,
I've been working using the govukDateInput component and was looking to disable the input boxes; I am using the <fieldset> variant. When passing in the property "attribute", I found that it was being ignored. e.g.

  {{ govukDateInput({
    value: 'the value',
    fieldset: {
      attributes: { 
        disabled: true 
      },
      legend: {
        text: t('common:dob'),
        isPageHeading: false,
        classes: 'govuk-fieldset__legend--s'
      }
    },
    hint: {
      text: t('common:dobHint')
    },
  })}}

I've looked at your codeset and the issue is with the attributes value you've had to add. This causes any attribute property passed in to be ignored:

  {% call govukFieldset({
    describedBy: describedBy,
    classes: params.fieldset.classes,
    attributes: {
      role: "group"
    },
    legend: params.fieldset.legend
  }) %}
  {{ innerHtml | trim | safe }}
  {% endcall %}

I think the solution is quite simple and should have no impact. A very rough example solution could be:

  {% call govukFieldset({
    describedBy: describedBy,
    classes: params.fieldset.classes,
    attributes: { ...params.fieldset.attributes, role: 'group' },
    legend: params.fieldset.legend
  }) %}
  {{ innerHtml | trim | safe }}
  {% endcall %}

I've decided against disabling these now, but this still seems worth fixing.
Thanks

@NickColley NickColley added the awaiting triage Needs triaging by team label Jul 8, 2019
@36degrees 36degrees added Effort: days and removed awaiting triage Needs triaging by team labels Jul 10, 2019
36degrees added a commit that referenced this issue Aug 28, 2019
This means that params.fieldset.attributes can be set, which is consistent with other components.

Fixes #1478
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

Successfully merging a pull request may close this issue.

3 participants