Problem/Motivation
When using a text area field with the ACE format, the field is marked as required. However, after saving the node and leaving the field empty, no validation error appears, and the field is not flagged as required. Checking the console logs reveals the following error:
field_name[0][value] is not focusable.
This indicates that the required validation is not being properly enforced because the field is hidden or not properly focusable.
Steps to reproduce
- Create a content type with a text area field that uses the ACE editor.
- Set the field to be required.
- Create a new node and leave the ACE field empty.
- Save the node.
- Observe that no validation error appears despite the field being required.
- Check the browser console and see the error: field[0][value] is not focusable.
Proposed resolution
Following the guidance from Drupal issue #1954968, the required validation should be removed from the hidden field to prevent this issue. Instead, validation should be handled at the JavaScript level or using proper visibility toggling.
Remaining tasks
- Investigate if the ACE editor field is correctly initializing in all scenarios.
- Modify the field validation logic to ensure required fields are validated correctly.
- Ensure that hidden fields do not trigger required validation.
- Test and confirm the fix in different browsers and scenarios.
- Submit a patch or merge request with the fix.
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ✅ Testing to ensure no regression
- ➖ Automated unit testing coverage
- ➖ Automated functional testing coverage
- ➖ UX/UI designer responsibilities
- ➖ Readability
- ➖ Accessibility
- ➖ Performance
- ➖ Security
- ➖ Documentation
- ✅ Code review by maintainers
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Release notes snippet
- ✅ Release ace_editor-2.0.2
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- Issue #3513683 by ahmad abbad: Required Validation Issue with ACE Editor Field
Issue fork ace_editor-3513683
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ahmad abbad commentedComment #4
ahmad abbad commentedComment #5
ahmad abbad commentedComment #8
rajab natshahComment #9
rajab natshah✅ Released ace_editor-2.0.2
Comment #10
rajab natshah