Feature #44757
openRemove the dependency on jQuery UI
Description
Redmine loads jQuery UI on every page, but uses only part of its features: the date picker, autocomplete, sortable lists, two effects, the progress bar, the resizable columns of the Gantt chart, tooltips and dialogs. jQuery UI is also in maintenance-only mode. Some of these features, namely the date picker, the progress bar and modal dialogs, are now provided by the browser, and the others can be implemented with Stimulus controllers, plain JavaScript and CSS.
The attached patches make these replacements and then stop loading jQuery UI. Pages no longer load 255 KB of JavaScript and 32 KB of CSS, and the JavaScript in Redmine moves further towards Stimulus.
Because there are 12 patches and some of them are large, they are attached as a single archive, remove-jquery-ui-patches.tar.gz. They can be applied in order with:
The patches are:
- Remove the jQuery UI datepicker in favor of the native date input
- Replace the jQuery UI autocomplete with a Stimulus controller
- Replace the jQuery UI sortable with a Stimulus controller
- Replace the jQuery UI switchClass with classList
- Replace the jQuery UI highlight effect with a CSS animation
- Replace the jQuery UI progressbar with the native progress element
- Replace the jQuery UI resizable with Pointer Events in the gantt column controller
- Replace the jQuery UI tooltip with a Stimulus controller
- Replace the jQuery UI dialog with the native dialog element
- Stop loading jQuery UI on every page
- Upgrade the bundled jQuery UI to 1.14.2
- Show hover tooltips on the workflow page
Changes for users
- Sortable lists, such as trackers, issue statuses and the blocks of My page, and the columns of the Gantt chart can also be reordered and resized on touch devices.
- Tooltips are also shown for content loaded by Ajax, which previously showed the browser's tooltip.
- The cells of the workflow page show the "old status ยป new status" title in the same tooltip as other elements, instead of the browser's tooltip. The no-tooltip class was added to them in #35034 because the jQuery UI tooltip, which was set up on each element with a title at page load, made the page very slow with many statuses (#34247). The new tooltip works through event delegation, so its cost does not depend on the number of elements. With 106 statuses (33,814 cells with a title), scripting takes about 180 ms both before and after the change, while removing no-tooltip with the jQuery UI tooltip took 343 seconds.
- Dialogs can no longer be moved by dragging the title bar. Modal dialogs in most web applications cannot be moved either, and this should rarely be needed, because the page behind them cannot be used while they are open.
Changes for plugins and themes
jQuery UI is still bundled, but is no longer loaded by Redmine. If it were removed now, each plugin that uses it would have to include its own copy, and plugins on the same page could load different versions of it. Plugins that use jQuery UI directly need to load the bundled one:
The file names have no version, so they do not need to be changed when the bundled jQuery UI is upgraded. The 11th patch upgrades it to 1.14.2, so plugins only need to be checked once against both changes. This supersedes #44739, whose changes to Redmine's own code are no longer needed. The bundled jQuery UI will be removed in a future version of Redmine.
The following functions keep working without jQuery UI, so plugins that use only them do not need to load it. They have these limitations:
showModalandhideModalnow open and close a native<dialog>, so thedialogcloseevent is no longer triggered.observeAutocompleteFieldandmultipleAutocompleteFieldsupport only a URL as the source and theselectcallback.$.fn.positionedItemssupports only theitemsandhandleoptions.
calendar_for and include_calendar_headers_tags now do nothing, because date fields use the native date picker. They are deprecated and will be removed in Redmine 8.0.
The following functions are removed:
setupHoverTooltipsandremoveHoverTooltips, which are no longer needed because tooltips work through event delegationdatepickerFallbackandbeforeShowDatePicker, which were used only by the jQuery UI date picker fallback
The following CSS classes are renamed:
| Before | After |
|---|---|
.ui-dialog, .ui-dialog-titlebar, .ui-dialog-content |
dialog.modal, .modal-header, .modal-content |
.ui-tooltip |
.hover-tooltip |
.ui-autocomplete |
.autocomplete-listbox |
tr.ui-sortable-helper |
.sortable-item-dragging |
.dragging (My page) |
.sortable-dragging |
.ui-resizable-e (Gantt chart) |
.gantt-column-resizer |
div.ui-progressbar |
progress |
Files