Problem/Motivation

When using ckeditor5_plugin_pack together with ckeditor5_plugin_pack_link_attributes and ckeditor5_plugin_pack_bookmark, the Link Attributes dialog can stop working after switching into Bookmark options and then backing out without selecting a bookmark. In that flow, opening Link Attributes afterward fails to apply attributes such as target. The browser console shows a CKEditor 5 error: document-selection-wrong-position, which indicates the editor selection has become invalid.

Steps to reproduce

  • Link attribute "Open in new window" is configured and enabled ckeditor5 text_format
  • Bookmarks are enabled in ckeditor5 text_format
  • Create a link in CKEditor.
  • Open the Bookmark options.
  • Click back in the Bookmark options without selecting anything.
  • Close the link dialog.
  • Open the Link Attributes options and try to set target.
  • Result: it is not possible to add link attributes.

Expected result:
Link Attributes should remain usable after leaving Bookmark options, even if no bookmark was selected.

Additional note:
"Internally" the plugin seems to work as it should, since the checkbox is enabled after closing and reopening the link attributes dialogue.

How to avoid the issue - but not a real fix
The issue can be avoided if, after step 3, you click Update in the link dialog before closing it.

Proposed resolution

Ensure the editor selection is properly restored or normalized when leaving Bookmark options without making a selection. The dialog flow should not leave CKEditor in a state where the selection points to an invalid model position. Link Attributes should be able to open and apply its values after the Bookmark subdialog is exited, regardless of whether a bookmark was chosen.

Remaining tasks

  • Fix the dialog close/back flow so it preserves or restores a valid selection.
  • Verify that Link Attributes works after the fix when switching between Bookmark and Link Attributes options.

User interface changes

No intended UI changes. This is a behavior fix for existing dialogs.

API changes

No API changes are expected.

Data model changes

No data model changes are expected. The fix should only affect selection handling and dialog behavior in the editor.

Comments

steffenr created an issue. See original summary.

steffenr’s picture

Issue summary: View changes
salmonek’s picture

StatusFileSize
new2.48 MB

Hi Steffen
We have tried to reproduce the issue, however without success. I'm attaching a screencast, please take a look and tell if we're doing something differently.