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

Update JavaScript components of the Design System website so they can be used with the createAll function #3812

Closed
1 task
Tracked by #5205
romaricpascal opened this issue May 21, 2024 · 0 comments · Fixed by #4053
Closed
1 task
Tracked by #5205
Assignees
Labels
javascript Pull requests that update Javascript code

Comments

@romaricpascal
Copy link
Member

What

Update the JavaScript components of the Design System website and their initialisation so they're instantiated by createAll calls rather than manual document.querySelector[All] and new calls.

As we do this, there's a couple of tidy ups that we should do:

  • OptionsTable and Navigation are not attached to any element. It's worth looking at whether they depend on a specific root (their names make it sound like they could) and if so if they can be updated to be initialised on a specific element
  • The data-module used by the Example component does not match the component name. For consistency, better to make them match
  • The Code component gets instanciated on the <pre> inside the element with data-module. It should be the responsibility of the Code component to find that <pre> (and throw in a similar fashion as the components in the Design System)
  • The Search, BackToTop and CookiePage use document.querySelector rather that querySelectorAll as there's only one in the page. There shouldn't be any harm in switching to createAll (which uses querySelectorAll). If components really need to be instanciated only once, we could have them throw in their constructor

Why

This will make the initialisation code more consistent as well as give us a safe way to explore how createAll could work for other components than those in the Design System itself.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Components of the Design System website are initialised through createAll
@romaricpascal romaricpascal added awaiting triage Needs triaging by team epic Epics are used in planning project boards to group related stories javascript Pull requests that update Javascript code and removed awaiting triage Needs triaging by team labels May 21, 2024
@romaricpascal romaricpascal removed the epic Epics are used in planning project boards to group related stories label Aug 9, 2024
@romaricpascal romaricpascal moved this to Backlog 🏃🏼‍♀️ in GOV.UK Design System cycle board Aug 9, 2024
@romaricpascal romaricpascal moved this from Backlog 🏃🏼‍♀️ to In progress 📝 in GOV.UK Design System cycle board Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Projects
Status: In progress 📝
Development

Successfully merging a pull request may close this issue.

1 participant