Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field prevents pages from saving (regardless of whether or not the field has content) #1908
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field prevents pages from saving (regardless of whether or not the field has content).
Expected behavior
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field should:
present a message and prevent saving if the field has no content; or
present no message and save the page if the field has content.
Actual behavior
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field prevents pages from saving (regardless of whether or not the field has content). There are no error messages, etc.; the page simply doesn't get saved.
While there are no user error messages, there is an error in the JavaScript console:
An invalid form control with name='body' is not focusable.
It's not focusable because it's display: none. Not just that: it has no content! That's why the page is trying to set focus to it in the first place; it thinks the required TinyMCE field is missing a value.
Optional: Suggestion for a possible fix
TinyMCE fields should, if possible, not present the "Also use HTML 5 "required" attribute?" option.
Steps to reproduce the issue
I created a TinyMCE field.
I added it to a template.
In the template I clicked on the field to override its attributes.
I clicked the "Input" tab.
I expanded the "Required?" section.
I checked "Required?".
I checked "Also use HTML 5 "required" attribute?".
I saved the template.
I created a page that used the template.
I added text to the TinyMCE field.
I clicked "Publish" and "Save + Keep Unpublished".
I expected the changes to be saved.
The changes weren't saved.
Setup/Environment
ProcessWire version: 3.0.227
(Optional) PHP version: 8.3
(Optional) MySQL version: MariaDB 10.6
(Optional) Any 3rd party modules that are installed and could be related to the issue:
Short description of the issue
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field prevents pages from saving (regardless of whether or not the field has content).
Expected behavior
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field should:
Actual behavior
Setting "Also use HTML 5 "required" attribute?" on a TinyMCE field prevents pages from saving (regardless of whether or not the field has content). There are no error messages, etc.; the page simply doesn't get saved.
While there are no user error messages, there is an error in the JavaScript console:
There is, in fact, a control with the name
body
:It's not focusable because it's
display: none
. Not just that: it has no content! That's why the page is trying to set focus to it in the first place; it thinks the required TinyMCE field is missing a value.Optional: Suggestion for a possible fix
TinyMCE fields should, if possible, not present the "Also use HTML 5 "required" attribute?" option.
Steps to reproduce the issue
Setup/Environment