Anchor name can invalidly include spaces

Created on 1 May 2025, about 1 month ago

Problem/Motivation

It is possible to include spaces in anchor link names. This is invalid HTML.

This is a regression from CKEditor 4. See issue Anchor name can invalidly include spaces #5305 and pull Disallow creating anchors with space characters #5362.

Standard cited for this issue: HTML 5.2 Recommendation concerning the ID attribute.

When specified on HTML elements, the id attribute value must be unique amongst all the IDs in the elementโ€™s tree and must contain at least one character. The value must not contain any space characters.

Steps to reproduce

1. As an admin, enable the anchor plug-in in the CKEditor5 WYSIWYG toolbar
2. As an editor, edit a node body
3. Click the anchor icon in the toolbar
4. In the anchor name field, type "beforespace afterspace" (without the quotes)
5. Click the check

Expected result: get an error message
Actual result: anchor is inserted with a space in the name

Proposed resolution

Filed with CKEditor5 as Anchor name can invalidly include spaces #18467

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Active

Version

11.1 ๐Ÿ”ฅ

Component

ckeditor5.module

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States charles belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024