processwire / processwire-issues

ProcessWire issue reports.
44 stars 2 forks source link

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

Closed michaellenaghan closed 3 months ago

michaellenaghan commented 3 months ago

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:

An invalid form control with name='body' is not focusable.

There is, in fact, a control with the name body:

<textarea class="FieldtypeTextarea required uk-textarea InputfieldTinyMCEEditor InputfieldTinyMCENormal InputfieldMaxWidth InputfieldTinyMCELoaded" id="Inputfield_body" name="body" rows="15" required="required" aria-hidden="true" style="display: none;"></textarea>

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

matjazpotocnik commented 3 months ago

@michaellenaghan, this is fixed in https://github.com/processwire/processwire-issues/issues/1893