Problem/motivation
CKEditor version 45 overhauled the Link editor. See https://ckeditor.com/docs/ckeditor5/latest/updating/guides/update-to-45.... . Drupal 10.5 and Drupal 11.2 update to CKEditor version 45.
During our testing for the upgrade to Drupal 10.5.x, we identified a bug that occurs when attempting to update the "Displayed text" of an existing link.
- Go to any node with CKEditor
- Add link by clicking on Link button from CKEditor
- In the Link URL field, set to 'www.youtube.com'
- The Displayed text field must be empty
- Click on insert
- Click on the link and edit it
- The Displayed text field should have the same value as the Link URL field
- Change the Displayed text field
- Click on update
This will generate the following errors on console:
Uncaught CKEditorError: Cannot read properties of undefined (reading 'attributes')
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Cannot read properties of undefined (reading 'attributes')
at mi.getChanges (ckeditor5-dll.js?v=45.2.0:5:428639)
at html-support.js?v=45.2.0:5:29843
at vi._callPostFixers (ckeditor5-dll.js?v=45.2.0:5:442557)
at vi._handleChangeBlock (ckeditor5-dll.js?v=45.2.0:5:441779)
at qi._runPendingChanges (ckeditor5-dll.js?v=45.2.0:5:476270)
at qi.change (ckeditor5-dll.js?v=45.2.0:5:473265)
at _.<anonymous> (editorAdvancedLink.js?v=10.5.1:1:2664)
at _.fire (ckeditor5-dll.js?v=45.2.0:5:639290)
at <computed> [as execute] (ckeditor5-dll.js?v=45.2.0:5:642831)
at f.execute (ckeditor5-dll.js?v=45.2.0:5:163419)
ckeditor5-dll.js?v=45.2.0:5 Uncaught CKEditorError: document-selection-wrong-position {"range":{"start":{"root":"main","path":[0,9],"stickiness":"toNone"},"end":{"root":"main","path":[0,9],"stickiness":"toNone"}}}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-document-selection-wrong-position
at Co._validateSelectionRanges (ckeditor5-dll.js?v=45.2.0:5:329930)
at Co._replaceAllRanges (ckeditor5-dll.js?v=45.2.0:5:329670)
at Co._setRanges (ckeditor5-dll.js?v=45.2.0:5:320078)
at Co.setTo (ckeditor5-dll.js?v=45.2.0:5:319218)
at Co.setTo (ckeditor5-dll.js?v=45.2.0:5:328804)
at Ao._setTo (ckeditor5-dll.js?v=45.2.0:5:326266)
at Pi.setSelection (ckeditor5-dll.js?v=45.2.0:5:455870)
at Object.callback (ckeditor5-dll.js?v=45.2.0:5:356853)
at qi._runPendingChanges (ckeditor5-dll.js?v=45.2.0:5:476216)
at qi.change (ckeditor5-dll.js?v=45.2.0:5:473265)
Steps to reproduce
While I haven’t been able to reproduce the issue consistently, I can trigger the error approximately 90% of the time. Given this frequency, I believe it's worth creating an issue for further discussion and investigation.
Steps to reproduce
1. Click the "Link" icon.
2. Enter a "Displayed text" value.
3. Enter the first character of an existing node and use Linkit's autocomplete to choose a result from the dropdown. Confirm that the internal path to the node is populated in the "Link URL" field.
4. Quickly(!) Remove the contents from the "Displayed text" input and quickly enter new text and press "Insert."
5. Link text will not be updated and the console will show the Uncaught CKEditorError: Cannot read properties of undefined (reading 'attributes') error.
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | ckeditor5.png | 194.77 KB | jannakha |
| #10 | 2025-07-16_09-33-16.png | 88 KB | nicholass |
Issue fork linkit-3535098
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mark_fullmerThanks for reporting this. I am able to reproduce. Specifically, using a generic installation of the Standard profile, adding Linkit to the Basic HTML text format:
1. Click the "Link" icon.
2. Enter a "Displayed text" value.
3. Enter the first character of an existing node and use Linkit's autocomplete to choose a result from the dropdown. Confirm that the internal path to the node is populated in the "Link URL" field.
4. Quickly(!) Remove the contents from the "Displayed text" input and quickly enter new text and press "Insert."
5. Link text will not be updated and the console will show the
Uncaught CKEditorError: Cannot read properties of undefined (reading 'attributes')error.Additionally, this is something else that doesn't work correctly.
1. Click the "Link" icon.
2. Enter a "Displayed text" value.
3. Enter the first character of an existing node and use Linkit's autocomplete to choose a result from the dropdown. Confirm that the internal path to the node is populated in the "Link URL" field.
4. Now click "Link URL" field again and enter the first character of another node and use Linkit's autocomplete to choose a different result.
5. The link field will NOT correctly populate the internal path to the node but will simply populate the character you entered.
Comment #3
mark_fullmerComment #4
mark_fullmerComment #6
mark_fullmerComment #7
mark_fullmerComment #8
mark_fullmerComment #9
mark_fullmerI've merged a number of changes related to CKEditor v45 compatibility to reduce the surface area here. The originally reported problem still remains, so this is "Needs work."
Comment #10
nicholassAlso had to disable the "Linkit profile" for Ckeditors after updating core 10.5 due to the error "Cannot convert undefined or null to object" in CKEditor 5 caused by a bug in the Linkit module version 6.1.6. Specifically, in the JavaScript file index.js at line 122, the code attempts to call Object.assign(args[2], values) where args[2] can be undefined or null. This occurs when the CKEditor 5 link command is executed with fewer than 3 arguments, but the code assumes the third argument (index 2) will always be an object.
When title is empty and clicking insert

UPDATE/UNRELATED
Ok so update on my issue, I guess its not related looks like I am on core 10.5.1 with 6.1.6 and the only compatible version is the 7.x, so I have to question why composer did that when I ran composer update. This may catch others.
Comment #11
jannakha commented@nicholass
when you're updating dependencies, especially when Drupal is updated, run command to check for any major versions of contrib modules:
composer outdated -M -Dcomposer update usually just updates minor version by default (eg 6.1 to 6.2) if dependency has carrot (^) "drupal/linkit": "^6.0", but not to 7.0
Comment #12
mrshowerman@mark_fullmer, see my comment in #3534699-14: [CKEditor5 v45+] Attributes can overwrite other attributes and editing displayed text from collapsed selection generates multiple links for another bug that is related to CKEditor 45. Not sure if this is the right place to report, but as @jannakha points out in their reply, it likely has to be fixed in Linkit.
Of course, I can also open a separate issue if that is preferred.
Comment #13
mark_fullmerIt appears that another community member created a separate issue for that today: #3540235: [CKEditor v45] Editing Displayed text from collapsed selection generates multiple links . I think it makes sense to initially keep that issue and this one tracked separately; if the fix ends up fixing both, fine :)
Thanks!
Comment #14
mark_fullmerI've created a new target development branch, 7.1.x, for this work, since it will require introducing backwards-compatibility-breaking changes. See https://www.drupal.org/project/linkit/releases/7.1.x-dev
Comment #15
mark_fullmerComment #16
giancarlorosa commentedDoing more tests, I found some specific behaviors related to this issue. First, I was using Linkit version 7.0.7, and this issue was happening through internal and external links. Now, I updated to version 7.0.8, and it seems that internal links are working just fine, but for external links, the issue still happens.
I've noticed that this issue tends to happen when, instead of selecting a text and adding a link, I add the link by directly clicking on the Link button from CKEditor. It's like if the created link does not have a reference to the element and can not update the Displyed text value.
Here are the steps to reproduce the issue:
This will generate the following errors on console:
If I execute the same process, but instead of adding a link by first clicking on the Link button, I first select a text inside CKEditor, the Linkit works fine.
Comment #17
jannakha commenteduse 7.0.7 and MR122 from https://www.drupal.org/project/linkit/issues/3535479 (hidden branch)
Comment #20
mark_fullmerI've confirmed that changes staged in the merge request for #3540235: [CKEditor v45] Editing Displayed text from collapsed selection generates multiple links do resolve this issue's problem, and would love confirmation of that from someone else that the "Steps to Reproduce" from #16 above result in successfully being able to change link text.
The problem of duplicated links is still present in the merge request for #3540235: [CKEditor v45] Editing Displayed text from collapsed selection generates multiple links, so I'm continuing to work on that...
Comment #22
mark_fullmerComment #23
agnesliu commentedEdited 9/10/2025: If it's an internal link, I'm able to change the "Displayed text". If it's an external link, I'm unable to update the "Displayed text" no matter the link url will be changed or not.
--------
I have similar issue with Linkit 7.0.8 (Drupal Core 10.5.2).
When I try to update an existing link, I cannot replace the "Displayed text" and the "link url" together. It does not seem to change anything after I click "Update" and I cannot make any edits anywhere anymore (editor freezing).
Comment #24
mark_fullmerThanks for reporting this, @agnesliu, and sorry to hear about the problematic editing. Given that you describe the editor "freezing," can you check whether the browser console reports any JavaScript errors when this happens? If so, can you post the error message here? Also, are you using any other modules or plugins related to CKEditor on the problem site, or is it just plain Drupal core 10.5.2 and Linkit 7.0.8?
Comment #25
agnesliu commentedCKEditor Accordion is the only other module that is related to CKEditor. The site is also using External Links, which just be used to differentiate between internal and external links.
In the console-
Uncaught CKEditorError: can't access property "attributes", s[a] is undefined
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#erro...'t access property "attributes", s[a] is undefined
Comment #26
mark_fullmerComment #29
mark_fullmerThis should be fixed, per the code changes added to the 7.0.9 release of Linkit. Note, however, that the other issue related to CKEditor v45 (i.e., Drupal 10.5+ and Drupal 11.2+), #3540235: [CKEditor v45] Editing Displayed text from collapsed selection generates multiple links, remains.
Comment #32
cdupreeIs anyone having issues with Displayed Text when applying a link to existing text in Drupal 11? It seems to be specifically when an entire line is selected, i.e. when triple-clicking to select. By contrast, clicking and dragging to select a substring of text and then applying a link works as expected.
Currently using:
Steps to reproduce:
This will generate the following errors in the console, similar to #16 above, and afterwards the user is unable to click elsewhere in the editor / the editor freezes, similar to #23, after the error is thrown:
Comment #33
mark_fullmerThanks, @cdupree, for reporting this. It had not yet been reported, and I can confirm that I can reproduce the issue with the Steps to Reproduce. I've created a new issue for resolving this problem: https://www.drupal.org/project/linkit/issues/3557993
Comment #34
jannakha commentedEmpty Display Text this is not an issue of linkit.
Empty Display Text is CKEditor5 itself (see screenshot) when you triple-click, CKEditor selects a whole paragraph and it doesn't put whole paragraph text into Displayed Text field.
Comment #35
cdupreeUpdate: posted this before reviewing the thread in the new issue in #33, I closed the issue with CKEditor.
--
Thank you for narrowing that down @jannakha. I opened a ticket in the CKEditor project: https://github.com/ckeditor/ckeditor5/issues/19373