Skip to content

Vanilla js conversion#1318

Draft
trubach wants to merge 7 commits into
5.xfrom
vanilla-js-conversion
Draft

Vanilla js conversion#1318
trubach wants to merge 7 commits into
5.xfrom
vanilla-js-conversion

Conversation

@trubach

@trubach trubach commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Fixes #1317

Converted all theme JavaScript to vanilla JS using Drupal.behaviors + once(), and removed jQuery as a dependency.

Converted (14 files -> Drupal.behaviors.<name> + once(id, selector, context), vanilla DOM)

  • Simple attr/class: paragraph-icon-row, -feature-group, -rt, -content-slider, -card, -image-gallery, -calendar, -list-content, -cta-narrow, -vertical-tab (removeAttr/attr/removeClass -> removeAttribute/setAttribute/classList).
  • With logic: paragraph-bb (matchMedia padding + resize bound once), paragraph-contact (captures [reverse] els, toggles on resize), paragraph-whitespace (sibling traversal via nextElementSibling/classList), google-cse (script injection guarded by once, reads drupalSettings).
  • table-mobile.js was already converted on the base branch.

illinois_framework_theme.libraries.yml

  • Removed all core/jquery dependencies (6 libraries).
  • Added explicit core/drupal + core/once to every library running a converted behavior.
  • Kept core/drupalSettings for google-cse and skipto-campus.

Verification

  • node --check passes on all 15 JS files.
  • libraries.yml validates as YAML.
  • Theme-wide sweep confirms zero remaining jQuery / $( / core/jquery.

Notes

  • paragraph-whitespace.js is an orphan (not referenced in libraries.yml); converted for completeness but not wired up - a pre-existing condition.
  • External libs (Toolkit web-components, SkipTo, ils-*) are vanilla and don't require jQuery.
  • Changes take effect after drush cr.

✅ Peer Review Checklist

Reviewers: Please verify the following before approving.

  • The pull request links to the issue it is addressing in the comment and in the "Development" section of the PR
  • There is a short summary that describes how the fix is implemented
  • Verifying work: Verify that the changes made are addressing the linked issue
  • Accessibility: Changes that might impact accessibility are reviewed to work with keyboard navigation and screen readers
  • Responsive: Layout is tested on desktop, tablet, and mobile screens
  • Config changes: Any configuration updates are tested and verified using the Distribution Update import
  • Security: Output is sanitized (using t(), Twig auto-escaping, etc.). No secrects included (API keys, etc.)
  • Cleanliness: All debug code (ksm(), dpm(), console.log) has been removed.
  • Comments: Complex logic is explained inline.
  • Documentation: Any relevant documentation has been updated (this can be a separate issue if needed)

📸 Screenshots / Video (Optional)

If this is a UI change, please attach a screenshot or a quick screen recording of the change in action.

nhjohnstone and others added 7 commits June 9, 2026 10:48
…move jQuery

Converted all theme JavaScript to vanilla JS using Drupal.behaviors + once(),
and removed jQuery as a dependency.

Converted (14 files -> Drupal.behaviors.<name> + once(id, selector, context),
vanilla DOM):
- Simple attr/class: paragraph-icon-row, -feature-group, -rt, -content-slider,
  -card, -image-gallery, -calendar, -list-content, -cta-narrow, -vertical-tab
  (removeAttr/attr/removeClass -> removeAttribute/setAttribute/classList).
- With logic: paragraph-bb (matchMedia padding + resize bound once),
  paragraph-contact (captures [reverse] els, toggles on resize),
  paragraph-whitespace (sibling traversal via nextElementSibling/classList),
  google-cse (script injection guarded by once, reads drupalSettings).
- table-mobile.js was already converted on the base branch.

illinois_framework_theme.libraries.yml:
- Removed all core/jquery dependencies (6 libraries).
- Added explicit core/drupal + core/once to every library running a converted
  behavior.
- Kept core/drupalSettings for google-cse and skipto-campus.

Verification:
- node --check passes on all 15 JS files.
- libraries.yml validates as YAML.
- Theme-wide sweep confirms zero remaining jQuery / $( / core/jquery.

Notes:
- paragraph-whitespace.js is an orphan (not referenced in libraries.yml);
  converted for completeness but not wired up - a pre-existing condition.
- External libs (Toolkit web-components, SkipTo, ils-*) are vanilla and don't
  require jQuery.
- Changes take effect after a cache rebuild (drush cr).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 this pull request may close these issues.

Convert theme JavaScript to vanilla JS (Drupal.behaviors + once) and remove jQuery

2 participants