Opened 6 years ago

Last modified 4 years ago

#14291 review Bug

Required-Attribute not correctly translated between Source- and WYSIWYG-Editor

Reported by: sbusse Owned by: Tade0
Priority: Normal Milestone:
Component: General Version: 4.5.0 Beta
Keywords: Cc:


Steps to reproduce

  1. Goto
  2. Open Source-View and delete it's content
  3. Add the following line:
  4. <input checked required type="checkbox" />
  5. Switch to WYSIWYG-View and then back to Source-View

Expected result

<input checked="checked" required="required" type="checkbox" />

Actual result

<input checked="checked" required="" type="checkbox" />

This happens with any input element with required attribute set and leads to the problem that if you edit the input element in the WYSIWYG-Editor, the required checkbox will be unchecked.

In our setup, we create the input element with WYSIWYG as required="required", it get's saved on the database as required (without value) and then loaded from datebase somewhen later resulting in a required="".

Other details (browser, OS, CKEditor version, installed plugins)

Browser: 47.0.2526.106 OS: Ubuntu 14.04 CKEditor: 4.5 Plugin: Forms

Change History (7)

comment:1 Changed 6 years ago by sbusse

Summary: Required-Attribute without value not correctly translated between Source- and WYSIWYG-EditorRequired-Attribute not correctly translated between Source- and WYSIWYG-Editor

comment:2 Changed 6 years ago by Jakub Ś

Status: newconfirmed
Version: Beta

First of all, this issue has been fixed recently in: #11583

Second, the value required, required="" and required="required" mean the same thing - field is required. Please see:

The problem is that the dialog treats required="" (also required because it is changed to required="") as empty value. We should either make boolean attributes treated as non-empty when they are present tag or assign them attribute name as value e.g. checked=checked.

I haven't found any list of boolean attributes for reference though. There are definitely required, checked, disabled, multiple and ...?

comment:3 Changed 6 years ago by Jakub Ś

NOTE: as a workaround you need to use required="required" all the time.

comment:4 Changed 5 years ago by rzueger

I fixed this issue and submitted a pull request:

With my fix, the required checkbox is checked - according to the HTML spec - if the value is an empty string or "required" (if the attribute is set without a value in the source code, CKEditor automatically sets an empty string as value).

Please have a look at the pull request. We are not able to use required="required" all the time - therefore, we need the fix as soon as possible.

comment:5 Changed 5 years ago by Tade0

Owner: set to Tade0
Status: confirmedreview

Included the changes from the PR, rebased with major, added manual test.

Changes pushed to branch:t/14291.

comment:6 Changed 5 years ago by Tade0

Priority: NormalNice to have (we want to work on it)

comment:7 Changed 4 years ago by Marek Lewandowski

Priority: Nice to have (we want to work on it)Normal
Note: See TracTickets for help on using tickets.
© 2003 – 2021 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy