Problem/Motivation
There was an issue: #1954968: Required CKEditor fields always fail HTML5 validation
"An invalid form control with name='{name}' is not focusable" JS error is thrown when a textarea has "required" attribute, but is not visible.
This was fixed in CKEditor: https://dev.ckeditor.com/ticket/8031
Now CKEditor removes the "required" attribute from textarea during initialization.
But the problem still exist if the "required" attribute is added via #states.
Steps to reproduce
Add states to node title and body field via form alter to make body field required when the node title is filled in.
Proposed resolution
Make this more reliable to handle if a field is changed to required via #states that the field gets marked as required and editors are notified when HTML5 validation fails,so that editors know what the problem is and can act on it.