govuk-developer-docs icon indicating copy to clipboard operation
govuk-developer-docs copied to clipboard

Fix site search

Open MartinJJones opened this issue 9 months ago • 0 comments

What

Fix site search

Why

Site search in the developer docs was defaulting to use Google search following a recent update in modules.js in the publishing-components-gem.

It appears this was conflicting with the approach used in the developer docs where jQuery is still used, and modules.js would initialise all modules on the page, even where jQuery is used.

This change copies over modules.js and dependencies.js from the publishing components gem.

modules.js has been updated so that only modules with an init method will start, this essentially returns to the approach before this change.

It may also be possible to update modules.js in the publishing components gem to avoid copying over from the gem, but in doing so, we would likely need to include some checks for jQuery which itself doesn't feel quite right and could send the wrong message for jQuery support in the gem.

Further info

There appears to be a console error when testing locally, this error was present before the update to 38.4.0 and may need to be investigated further.

Error starting Search component JS: window.stripPIIFromString is not a function

MartinJJones avatar May 22 '24 13:05 MartinJJones