Opened 9 years ago
Last modified 8 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: |
Description
Steps to reproduce
- Goto http://ckeditor.com/demo#full
- Open Source-View and delete it's content
- Add the following line:
- <input checked required type="checkbox" />
- 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 9 years ago by
Summary: | Required-Attribute without value not correctly translated between Source- and WYSIWYG-Editor → Required-Attribute not correctly translated between Source- and WYSIWYG-Editor |
---|
comment:2 Changed 9 years ago by
Status: | new → confirmed |
---|---|
Version: | 4.5.0 → 4.5.0 Beta |
comment:3 Changed 9 years ago by
NOTE: as a workaround you need to use required="required"
all the time.
comment:4 Changed 9 years ago by
I fixed this issue and submitted a pull request:
https://github.com/ckeditor/ckeditor-dev/pull/276
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 8 years ago by
Owner: | set to Tade0 |
---|---|
Status: | confirmed → review |
Included the changes from the PR, rebased with major
, added manual test.
Changes pushed to branch:t/14291.
comment:6 Changed 8 years ago by
Priority: | Normal → Nice to have (we want to work on it) |
---|
comment:7 Changed 8 years ago by
Priority: | Nice to have (we want to work on it) → Normal |
---|
First of all, this issue has been fixed recently in: #11583
Second, the value
required
,required=""
andrequired="required"
mean the same thing - field is required. Please see:https://html.spec.whatwg.org/multipage/forms.html#concept-input-required
https://html.spec.whatwg.org/multipage/infrastructure.html#boolean-attribute
http://www.w3.org/TR/2012/WD-html5-20121025/common-input-element-attributes.html#the-required-attribute
http://www.w3.org/TR/2012/WD-html5-20121025/common-microsyntaxes.html#boolean-attribute
The problem is that the dialog treats
required=""
(alsorequired
because it is changed torequired=""
) 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 ...?