Skip to content

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Jul 6, 2025

⚠️ This PR includes commits from #20846. Please review/merge that first.

Ticket

https://community.openproject.org/wp/65618

What are you trying to accomplish?

Screenshots

What approach did you choose and why?

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)
  • Visual/manual testing - particular areas to look at include:
    • General and Work Packages Tables - scrolling behavior
    • Timelines and Gantt Chart - rendering and zoom
    • Global Search - focus
    • Work Packages - Bulk Destroy
    • Work Packages - inline create
    • Context menu positioning (gravity/direction, padding) (Angular views)
    • Context menu - focus on open/keyboard handling
    • Onboarding Tours
    • Types - Form configuration

@myabc myabc changed the title Code maintenance/rid jquery [#65618] Remove jQuery from core Jul 8, 2025
@myabc myabc added maintenance DO NOT MERGE javascript Pull requests that update Javascript code labels Jul 8, 2025
@myabc myabc force-pushed the code-maintenance/luxon branch from 28d3b33 to dabe404 Compare July 15, 2025 10:45
@myabc myabc force-pushed the code-maintenance/rid-jquery branch from 8ecb545 to c7be23c Compare July 15, 2025 10:57
@myabc myabc force-pushed the code-maintenance/luxon branch from dabe404 to 12c2e01 Compare July 23, 2025 16:15
@myabc myabc force-pushed the code-maintenance/luxon branch 8 times, most recently from 8c63a12 to 5d26905 Compare September 28, 2025 22:45
@myabc myabc force-pushed the code-maintenance/luxon branch 2 times, most recently from af9f3f5 to 84518cd Compare October 28, 2025 11:46
@myabc myabc force-pushed the code-maintenance/rid-jquery branch from c7be23c to c0ad5e2 Compare October 28, 2025 13:13
@myabc myabc requested a review from Copilot October 28, 2025 13:14
@myabc myabc changed the base branch from code-maintenance/luxon to dev October 28, 2025 13:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes jQuery dependencies from the OpenProject core codebase, replacing jQuery APIs with native DOM APIs and modern JavaScript/TypeScript alternatives. The changes include migrating event listeners, DOM manipulation, element selection, CSS manipulation, and AJAX operations away from jQuery while maintaining the same functionality.

Key changes:

  • Replace jQuery selectors with document.querySelector/querySelectorAll
  • Replace jQuery event binding (.on(), .off()) with native addEventListener/removeEventListener
  • Replace jQuery DOM manipulation methods with native alternatives
  • Update type definitions from JQuery.TriggeredEvent to native Event, MouseEvent, KeyboardEvent

Reviewed Changes

Copilot reviewed 138 out of 139 changed files in this pull request and generated 25 comments.

Show a summary per file
File Description
frontend/package.json Adds dependencies for jQuery-free event delegation (@knowledgecode/delegate) and slide animations (es6-slide-up-down)
frontend/src/app/shared/helpers/dom-helpers.ts New utility module providing jQuery-like helper functions using native DOM APIs
modules/*/frontend/module/git-actions-menu/git-actions-menu.directive.ts Updates event type from JQuery.TriggeredEvent to Event
modules/budgets/frontend/module/augment/planned-costs-form.ts Replaces jQuery event delegation with @knowledgecode/delegate library
frontend/src/turbo/turbo-global-listeners.ts Replaces jQuery .each() with native forEach()
frontend/src/app/shared/helpers/link-handling/link-handling.ts Updates event type from JQuery.TriggeredEvent to MouseEvent
frontend/src/app/shared/helpers/drag-and-drop/dom-autoscroll.service.ts Replaces jQuery event binding with native addEventListener
frontend/src/app/shared/directives/*/*.ts Multiple directive files updating from jQuery element references to native HTMLElement
frontend/src/app/shared/components/*/*.ts Component files migrating from jQuery to native DOM APIs for element manipulation and event handling
frontend/src/app/features/work-packages/components/wp-table/*.ts Work package table components replacing jQuery with native DOM operations
frontend/src/app/features/calendar/*.ts Calendar components removing jQuery tooltip and DOM manipulation calls
frontend/src/app/core/setup/globals/*.ts Global listener setup replacing jQuery with native event handling
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

@myabc myabc force-pushed the code-maintenance/rid-jquery branch from c0ad5e2 to 07e86f2 Compare October 28, 2025 18:31
@myabc myabc force-pushed the code-maintenance/rid-jquery branch from 0b5ff43 to 24f8775 Compare October 28, 2025 20:57
@myabc myabc force-pushed the code-maintenance/rid-jquery branch from 24f8775 to 9e4b33c Compare October 28, 2025 22:59
@myabc myabc requested a review from Copilot October 28, 2025 23:00
@myabc myabc force-pushed the code-maintenance/rid-jquery branch from a5ceaf4 to c901941 Compare November 4, 2025 09:27
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 09:28 Inactive
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 09:36 Inactive
myabc added 3 commits November 4, 2025 12:47
Fixes:

  <internal:warning>:54:in 'Kernel.warn': Locator Type:#<Type id: 1008, name: "Type No. 1", position: 5, is_in_roadmap: true, is_milestone: false, is_default: false, color_id: nil, created_at: "2025-11-04 12:57:37.377907000 +0000", updated_at: "2025-11-04 12:57:37.377926000 +0000", is_standard: false, attribute_groups: [], description: nil, patterns: #<data WorkPackageTypes::Patterns::Collection patterns={}>, pdf_export_templates_config: {}> for selector :option must be an instance of String or Symbol or Integer. This will raise an error in a future version of Capybara. Called from: /home/git-repos/openproject/modules/backlogs/spec/support/pages/backlogs.rb:61 (StructuredWarnings::BuiltInWarning)
  <internal:warning>:54:in 'Kernel.warn': Locator Integer:255 for selector :link must be an instance of String or Symbol or Array. This will raise an error in a future version of Capybara. Called from: /home/git-repos/openproject/modules/backlogs/spec/support/pages/backlogs.rb:214 (StructuredWarnings::BuiltInWarning)
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 13:06 Inactive
Comment on lines +75 to +82
element.dispatchEvent(
new CustomEvent('op:dragscroll', {
detail: {
x: evt.clientX - mousedownX,
y: evt.clientY - mousedownY,
},
}),
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Check are we event listening for this event?

@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 16:36 Inactive
myabc added 2 commits November 4, 2025 17:53
Ensure menu positioning is complete. Make focus take place after next
repaint.
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 17:54 Inactive
dropDown.querySelector<HTMLAnchorElement>('li > a:first-child')?.focus();
// when clicking on something, which is not the menu, close the menu
jQuery('html').on('click', { menu: menu.get(0) }, closeMenu);
document.addEventListener('click', (evt) => closeMenu(menu, evt), { once: true });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check

@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 18:51 Inactive
Replaces inline jQuery code with `select-autosize` Stimulus controller.
Also applies inline style to fix select height.
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 19:40 Inactive
@github-actions github-actions bot temporarily deployed to gh-6899875-pr-19429 November 4, 2025 19:47 Inactive
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 maintenance needs review pullpreview

Development

Successfully merging this pull request may close these issues.

2 participants