alphagov/govuk_frontend_toolkit

GOVUK SelectionButtons setInitialState requires jQuery object instead of list of elements

Closed this issue · 3 comments

Should the SelectionButtons setInitialState method be less restrictive on the attributes it accepts?

https://github.com/alphagov/govuk_frontend_toolkit/blob/master/javascripts/govuk/selection-buttons.js#L33

I was following https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/javascript.md#selection-buttons and the usage of setInitialState when I discovered that it needed a jQuery Object instead of a selector string to loop through.

I'm happy to either update the guidance and/or propose a change to help support both jQuery and selector string but wondered what others thought about it.

Makes sense to me, as mentioned in the Cross Government Slack by @colinrotherham if we do this it means we can remove the jQuery dependency in the future if we want to.

I'm working on a PR for this issue.

Following the launch of the GOV.UK Design System, GOV.UK Frontend Toolkit will now only get major bug fixes and security patches, so I'm going to close this given the lack of activity.

As it happens, the selection buttons JavaScript is no longer required as long as you are using GOV.UK Elements 3.0 or above.