diff -u b/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js --- b/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -274,19 +274,21 @@ }); /** - * Pull the ID from the original textarea, that gets hidden. Specifically for jump-to - * links used with Inline Form Errors. + * Pull the ID from the original textarea, that gets hidden. Specifically for + * jump-to links used with Inline Form Errors. */ function redirectTextareaFragmentToCKEditorInstance() { var hash = location.hash.substr(1); var element = document.getElementById(hash); if (element) { var editor = CKEDITOR.dom.element.get(element).getEditor(); - var id = editor.container.getAttribute('id'); - document.location.hash = '#' + id; + if (editor) { + var id = editor.container.getAttribute('id'); + document.location.hash = '#' + id; + } } } - window.addEventListener('hashchange', redirectTextareaFragmentToCKEditorInstance); + $(window).on('hashchange', redirectTextareaFragmentToCKEditorInstance); // Set the CKEditor cache-busting string to the same value as Drupal. CKEDITOR.timestamp = drupalSettings.ckeditor.timestamp;