Problem/Motivation
The security update to Drupal core 7.86 includes some fixes to jQuery UI that are backported from 1.13 to 1.10.2. These seem to be causing a JS error when Linkit is enabled in WYSIWYG fields or link fields.
From the stack trace it looks like part of the problem may lie in Better Autocomplete, which is bundled with Linkit. In issue #3024014: Update BAC - Better autocomplete it's mentioned that Better Autocomplete seems to be abandoned.
Steps to reproduce
- Install a Drupal site with the jQuery Update and Linkit modules enabled.
- Set jQuery Update to use version 1.10.
- Enable Linkit on a link field.
- Activate the Linkit button when editing the field.
- Note the Search for content field doesn't do anything.
Stack trace:
jquery.ui.position-1.13.0-backport.js?v=1.10.2:21 Uncaught TypeError: Cannot read properties of undefined (reading 'of')
at $.fn.init.position (jquery.ui.position-1.13.0-backport.js?v=1.10.2:21:35)
at Object.insertSuggestionList (linkit.dashboard.js?v=7.3:207:28)
at new BetterAutocomplete (jquery.better-autocomplete.js?v=1.0:187:15)
at HTMLInputElement.init (jquery.better-autocomplete.js?v=1.0:109:19)
at HTMLInputElement.<anonymous> (jquery.better-autocomplete.js?v=1.0:128:27)
at Function.each (jquery.min.js?v=1.10.2:4:5347)
at $.fn.init.each (jquery.min.js?v=1.10.2:4:1999)
at $.fn.init.$.fn.betterAutocomplete (jquery.better-autocomplete.js?v=1.0:125:10)
at HTMLInputElement.<anonymous> (linkit.dashboard.js?v=7.3:240:21)
at Function.each (jquery.min.js?v=1.10.2:4:5347)
Proposed resolution
Patch Linkit and/or Better Autocomplete.
Remaining tasks
Patch Linkit and/or Better Autocomplete.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comments
Comment #2
chrisgross commentedI can confirm this. Changing to critical since it breaks the core functionality of this module.
Comment #3
cboyden commentedIt's possible that this is a bug in the core backport. Linkit calls the position function without any options:
var top = $input.position().top + $input.outerHeight() - 5;Which seems to be allowed. But the core backport expects that there will be options:
which causes "Cannot read properties of undefined" because there is no options object to act on.
Filed a core issue: #3259465: jQuery backport causes downstream JS errors.
Comment #4
chrisgross commentedI just confirmed that updating Drupal to 7.87 fixes this. @boyden thanks for the reporting the core bug. Thankfully, it was fixed quickly!
Comment #5
jdleonardClosing as duplicate of core bug where this was fixed: #3259465: jQuery backport causes downstream JS errors