accessdigital / wilson

A Drupal installation profile produced by Access. New installations should use https://github.com/accessdigital/drupal-template
https://www.weareaccess.co.uk
4 stars 1 forks source link

Refactor main menu JS & styling #45

Closed AccessPaul closed 1 year ago

AccessPaul commented 1 year ago

While updating the Wilson demo site, I discovered that the main menu javascript was very broken, and stupidly complex. This PR refactors the JS and styling for the main menu to fix the issues I spotted.

I rewrote the JS to use use Drupal once so that click events wouldn't be fired twice, which was the main reason why the menus weren't opening correctly. I also reduced some complexity by making makeActive and makeInactive functions that help reduce repeated code.

@ismael-abujadur I'm raising this PR against Wilson, but I'd strongly recommend you copy the updated files in to your custom WaterUK theme before you get too far along with the customisation.

AccessPaul commented 1 year ago

Adding a video of the latest version of this. Changes include:-

https://user-images.githubusercontent.com/1227987/221359844-9eb7b51e-1e69-4eae-9034-5e754d982c76.mov