Skip to content
Snippets Groups Projects

Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS

Closed Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS
Closed Harumi Jang requested to merge issue/drupal-3238915:3238915-refactor-if-feasible into 9.3.x
3 files
+ 6
26
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -7,23 +7,12 @@
*/
(($) => {
// Get core version of the _focusTabbable method.
const oldFocusTabbable = $.ui.dialog._proto._focusTabbable;
$.widget('ui.dialog', $.ui.dialog, {
// Override core override of jQuery UI's `_focusTabbable()` so that
// Override core override of jQuery UI's `_allowInteraction()` so that
// CKEditor 5 in modals can work as expected.
_focusTabbable() {
// When the focused element is a CKEditor 5 instance, disable jQuery UI
// focus trap and delegate focus trap to CKEditor 5.
const hasFocus = this._focusedElement
? this._focusedElement.get(0)
: null;
// In case the element is a CKEditor 5 instance, do not change focus
// management.
if (!(hasFocus && hasFocus.ckeditorInstance)) {
oldFocusTabbable.call(this);
}
// @see https://api.jqueryui.com/dialog/#method-_allowInteraction
_allowInteraction(event) {
return event.target.classList.contains('ck') || this._super(event);
},
});
})(jQuery);
Loading