Skip to content
Snippets Groups Projects

Resolve #3500385 "Display validation errors"

Closes #3500385

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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', () => {
  • Author Maintainer

    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.

  • Please register or sign in to reply
  • Ben Mullins
  • Ben Mullins added 1 commit

    added 1 commit

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • ffc9c523 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Ben Mullins marked this merge request as ready

    marked this merge request as ready

  • Ben Mullins added 12 commits

    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

    Compare with previous version

  • Harumi Jang added 8 commits

    added 8 commits

    Compare with previous version

  • Harumi Jang
  • 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

    Screenshot_2025-04-18_at_12.15.43_PM

    Screenshot_2025-04-18_at_12.16.12_PM

  • Or actually maybe we can utilize ErrorBoundary.tsx component and show a small alert like this, where in the alert there is a link/button that will scroll down to the errors.

    Screenshot_2025-04-18_at_12.36.36_PM

  • Ben Mullins added 1 commit

    added 1 commit

    • c8238556 - make it smoother and clicker

    Compare with previous version

  • 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 {
    • I tested this with entity validation and it didn't seem to work in all cases

      You can see a tags field here where I typed in some rubbish that didn't match a term - and the preview correctly bubbled the form error Screenshot_from_2025-04-22_12-09-43

      but I wasn't prevented from saving image

    • Author Maintainer

      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.

    • Please register or sign in to reply
  • Lee Rowlands left review comments

    left review comments

  • Ben Mullins added 5 commits

    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

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading