Resolve #3500385 "Display validation errors"
Closes #3500385
Merge request reports
Activity
- ui/tests/e2e/publish-validation.cy.js 0 → 100644
63 'I am an empty node', 64 ]; 65 $errorsContainer.find('h4').each((index, h4) => { 66 expect(h4).to.include.text(expectedH4[index]); 67 }); 68 $errorsContainer 69 .find('[data-testid="publish-error-detail"]') 70 .each((index, errorDetail) => { 71 expect(errorDetail).to.include.text( 72 'The value "invalid constraint" is not allowed in this field.', 73 ); 74 }); 75 }); 76 }); 77 78 it('Publish process does not currently notice form validation errors', () => { Note: This is sort of out of scope, but given there was a mistaken impression that form validation errors were available, I thought it would be helpful to include a test that distinguishes how this validation behavior differs from the constraint validation, and potentially alert us to additional functionality we need to work on.
- Resolved by Ben Mullins
added 12 commits
-
ffc9c523...0dcb1e5c - 10 commits from branch
project:0.x
- 0df79863 - really stick it to that autosave
- 1efe6bc3 - Merge remote-tracking branch 'origin/0.x' into 3500385-display-validation-errors
-
ffc9c523...0dcb1e5c - 10 commits from branch
added 8 commits
-
1efe6bc3...db66853d - 7 commits from branch
project:0.x
- aa6feab9 - Merge branch '0.x' into 3500385-display-validation-errors
-
1efe6bc3...db66853d - 7 commits from branch
- Resolved by Harumi Jang
- Resolved by Harumi Jang
When someone has a long list of changes, the errors don't appear unless the user scrolls down the panel. Otherwise it's completely out of view and there's no other indication the publishing failed. One idea I have is to show a Toast message to indicate there were errors and then programmatically control the scroll to be at the position of the errors.
Ok with this being a UX improvement follow-up in case we want input from UX team
1 <?php 2 3 /** 4 * @file 5 * Contains xb_test_invalid_field.module. 6 */ 7 8 declare(strict_types=1); 9 10 use Drupal\Core\Form\FormStateInterface; 11 use Drupal\Core\Entity\EntityTypeInterface; 12 13 /** 14 * Implements hook_entity_bundle_field_info_alter(). 15 */ 16 function xb_test_invalid_field_entity_bundle_field_info_alter(array &$fields, EntityTypeInterface $entity_type, string $bundle): void { could we avoid adding new .module files now we require 11.1 as a minimum? https://www.drupal.org/node/3442349 - we're paying 3 mins extra per CI run already because of the procedural hook scans - would be good to make all new code use OO hooks.
#3517636 has some examples
The scope of this issue is to display the validation errors provided by the
/xb/api/auto-saves/publish
endpoint. Currently the only errors provided in by the endpoint are when entity validation constraints don't pass. Form validation errors are not part of this.See this comment which is referencing a test I added to demonstrate this and hopefully make this (imo) limitation better known.
added 5 commits
-
c8238556...69800f02 - 4 commits from branch
project:0.x
- 10de8139 - Merge remote-tracking branch 'origin/0.x' into 3500385-display-validation-errors
-
c8238556...69800f02 - 4 commits from branch