Problem:

Inline Form Errors is not at all compatible with Quick Edit.

  1. The actual error messages are lost because once the form submission is validated, the form is not there anymore and inline form errors would display the error on the form that is not there.
  2. The anchor links to the form are not needed and not working, because the form is not there anymore.

Solution:

During the UX discussion of 22 november 2016 it was agreed that for Inline Form Errors it is enough to disable IFE while in Quick Edit. Because, by default, the errors are already near the problematic fields. And this is similar to how IFE works. Also it means quick edit works as it did without enabling Inline Form Errors.

The solution in this issue is a fix that could get into 8.3 + durable tests.

Next steps:

Before this patch with Quick Edit and Inline Form Errors enabled:

After this patch with Quick Edit and Inline Form Errors enabled (also same if disabled):

CommentFileSizeAuthor
#74 Lucas ipsum dolor sit amet jinn darth lando endor mon | drupal 8.3.x 2017-03-14 09-46-41.png97.66 KBGábor Hojtsy
#74 Lucas ipsum dolor sit amet cassio luuke hypori lannik lowbacca | drupal 8.3.0-rc1 2017-03-14 09-52-15.png93.29 KBGábor Hojtsy
#72 interdiff-45-72.txt688 bytesgaurav.kapoor
#72 2828092-72.drupal.Inline-Form-Errors-not-compatible-with-Quick-Edit-.patch5.87 KBgaurav.kapoor
#69 interdiff-45-69.txt3.43 KBgaurav.kapoor
#69 2828092-69.patch2.87 KBgaurav.kapoor
#50 ife_quick_edit_title_after.png9.6 KBdmsmidt
#45 interdiff-2828092-41-45.txt1.63 KBandrewmacpherson
#45 2828092-45.drupal.Inline-Form-Errors-not-compatible-with-Quick-Edit-.patch5.87 KBandrewmacpherson
#41 interdiff.2828092.38.txt1.37 KBdmsmidt
#41 2828092-41.drupal.Inline-Form-Errors-not-compatible-with-Quick-Edit-.patch5.82 KBdmsmidt
#38 2828092-38.drupal.Inline-Form-Errors-not-compatible-with-Quick-Edit-.patch5.78 KBdmsmidt
#37 2828092-37.drupal.Inline-Form-Errors-not-compatible-with-Quick-Edit-TESTS_ONLY.patch4.86 KBdmsmidt
#30 2828092-30-ife_quick_edit.patch2.82 KBdmsmidt
#13 2828092-10-ife_quick_edit.patch2.81 KBdmsmidt
#10 2828092-08-ife_quick_edit.diff902 bytesdmsmidt
#10 2828092-10-ife_quick_edit_TEST_ONLY.patch1.89 KBdmsmidt
#10 interdiff-2828092-8-10.txt2.49 KBdmsmidt
#8 2828092-08-ife_quick_edit.diff902 bytesdmsmidt
#7 2828092-07-ife_quick_edit.diff910 bytesdmsmidt
#4 2828092-error-message-inside-quickedit-box.patch633 bytessamuel.sirois
#4 drupal-issue-2828092-after.png12.26 KBsamuel.sirois
#4 drupal-issue-2828092-before.png15.42 KBsamuel.sirois
#2 ife_quick_edit_image.png24.17 KBdmsmidt
ife_quick_edit_body.png18.17 KBdmsmidt
ife_quick_edit_body.png18.17 KBdmsmidt
ife_quick_edit_title.png12.61 KBdmsmidt
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dmsmidt created an issue. See original summary.

dmsmidt’s picture

Issue summary: View changes
FileSize
24.17 KB
marcvangend’s picture

Is there a design or UX guideline for how we want this to be? I rather like how in one of your screenshots, the error message ends up inside the quick edit dialog. I think it's a nice way to keep the underlying page as wysiwyg as can be, and be less dependent on front end theming.

samuel.sirois’s picture

Running this on 8.3.x : this is what I can see :

Error message appears outside the quick edit box, just after the the erronous.

Which seems better that what was found originally when this issue was opened.

Jumping on what @marcvangend said at #3, here is a patch that moves the error message inside the quick edit box.

Error message appears inside the quick edit box.

See patch 2828092-error-message-inside-quickedit-box.patch

dmsmidt’s picture

Issue summary: View changes

@s.d.sirois, thank you for that first patch. Could you please reupload it to #2831546: Move Quick Edit error messages inside dialog (see description for explanation).

dmsmidt’s picture

dmsmidt’s picture

Status: Active » Needs review
FileSize
910 bytes

This patch disables IFE for quick edit forms.

dmsmidt’s picture

FileSize
902 bytes

Fix typo.

The last submitted patch, 7: 2828092-07-ife_quick_edit.diff, failed testing.

dmsmidt’s picture

- Fix existing test,
- Improve inline doc,
- Add new test to make sure normal errors are shown for quick edit forms (added test only patch: should fail)

The last submitted patch, 10: 2828092-10-ife_quick_edit_TEST_ONLY.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 10: 2828092-08-ife_quick_edit.diff, failed testing.

dmsmidt’s picture

Sorry for the mess, wrong upload.

dmsmidt’s picture

Status: Needs work » Needs review
samuel.sirois’s picture

I am sorry for my lack of feedback on this issue. I'll make sure to double-check my account's settings in order to receive email notifications (which I obviously didn't receive).

@dmsmidt Do you need me to upload the patch as-is to #2831546 or do you wish me to make some modifications first ?

dmsmidt’s picture

I guess it needs some modification, but just reupload it for context and review.
If you'd like you can review the new patch here.

samuel.sirois’s picture

Reviewed 2828092-10-ife_quick_edit.patch and behaviour looks like the expected one.

Of course, rises #2831546 that needs to be fixed.

Anonymous’s picture

I've applied this patch to an 8.3.x instance on simplytest.me with partial success (and complete success on the cases I was able to reproduce).

An inline form error appears inside the dialog box if I try to assign a non-existent author, for example:

Only local images are allowed.

Here, the user "Foo" doesn't exist, and the error notification shows up right above the Quickedit input form. It's visible, and doesn't have the (unnecessary) anchor.

I also get the desired behaviour when setting an empty (invalid) title field:

Only local images are allowed.

I can't reproduce the behaviour shown when editing an image's alt text, though; Quickedit just doesn't let me modify that.

dmsmidt’s picture

@all, thanks for testing.

@jules. Do you mean, by "partial success", that everything you tested worked, but that you couldn't test it for images?
For images it works like in this gif.

dmsmidt’s picture

Issue summary: View changes
Anonymous’s picture

@dmsmidt that's what I meant, sorry about the ambiguity.

I can't recreate the behaviour on drag-and-drop in Drupal 8 with Firefox 50.1.0; instead, the image just gets loaded into the browser as a local location, and is simply displayed as a normal image. Because of time constraints, I won't be able to provide updates anymore.

xjm’s picture

According to feedback from the product and UX team on #2504847: [meta] Roadmap for stabilizing Inline Form Errors module (IFE), disabling IFE for Quick Edit is an acceptable workaround. However, we should also consider a postponed followup issue to better integrate Quick Edit and IFE. That followup issue would not be a blocker for IFE, just a future task for better user experience.

Thanks everyone!

dmsmidt’s picture

@xjm, this is the follow up: #2831546: Move Quick Edit error messages inside dialog, people are already looking into it.

Anyone wants to review this further (it is confirmed working in #17), or can we RTBC this soon?

Wim Leers’s picture

This should update the IS with before/after screenshots. Because the screenshots currently show a solution that doesn't match the proposed solution.

Wim Leers’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/inline_form_errors/src/FormErrorHandler.php
    @@ -53,6 +53,13 @@ public function __construct(TranslationInterface $string_translation, LinkGenera
    +    if ($form['#form_id'] == 'quickedit_field_form') {
    

    ===

  2. +++ b/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php
    @@ -127,4 +129,34 @@ public function testSetElementErrorsFromFormState() {
    +  /**
    +   * Test that Quick Edit forms show non-inline errors.
    +   *
    +   * @covers ::handleFormErrors
    +   * @covers ::displayErrorMessages
    +   */
    +  public function testDisplayErrorMessagesNotInlineQuickEdit() {
    

    This is the sort of thing that really needs a functional test, not a unit test. A unit test doesn't give enough guarantees here, because it's only the integration of many things (form system, Quick Edit, user interactions) that can prove this works as intended.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tstoeckler’s picture

+++ b/core/modules/inline_form_errors/src/FormErrorHandler.php
@@ -53,6 +53,13 @@ public function __construct(TranslationInterface $string_translation, LinkGenera
+    if ($form['#form_id'] == 'quickedit_field_form') {

I was wondering whether it wouldn't be nicer to have a sort of $form['#disable_inline_form_errors'] = TRUE flag or something like that. That way Quickedit could set that on its form, but it would also allow contrib modules that run into similar issues to do the same. And it wouldn't introduce any knowledge about Quickedit in inline_form_errors.

dmsmidt’s picture

@tstoeckler this is sort of proposed in #2848319: Find a way to make it easier to hide Inline Form Error messages on child elements, but I fear that if we make that a blocker of this, it will take ages again.
We also should consider not making it to easy to disable IFE, we want contrib to be accessible as well.

I hope we can do this in two steps, so first fix it like this, and then make the solution more pretty. But I may be biased about this ;-)

tstoeckler’s picture

No, that's absolutely legitimate. Nice that there's already a follow-up for that.

dmsmidt’s picture

Reroll against 8.4.x.

mgifford’s picture

Status: Needs work » Needs review
dmsmidt’s picture

Status: Needs review » Needs work
Issue tags: +Needs testing

Actually also still needs work. Functional test is needed.

Furthermore I was rethinking #27, and the followup I mentioned in #28 doesn't really cover the case. It will only prevent bubbling of error messages to child elements. But doesn't help with disabling IFE for a form altogether.
So maybe we should try an alternative (cleaner) approach. Indeed we could add a property to a $form element to disable IFE.
Then we would need to change Quick Edit as well.

tim.plunkett’s picture

Issue tags: -Needs testing

Already has the "Needs tests" tag

For whoever does write the test, please use BrowserTestBase or JavascriptTestBase, and not WebTestBase.

dmsmidt’s picture

Assigned: Unassigned » dmsmidt

Working on a functional test.

dmsmidt’s picture

Assigned: dmsmidt » Unassigned

I've a test prepared, however I suddenly can't run functional tests anymore locally (multiple machines which worked before).

Offtopic

If any genius can get me up to speed again, please reach out to me I've already lost hours.

I've tried PhantomJS 2.1.1 and PhantomJS 1.9.2, PHP 7.1 and 5.6, Drupal 8.2 and 8.4.

The error I get: "An unexpected error occurred while starting Mink", is due problems in JavascriptTestBase->initMink().

After some debugging I see a ServerException thrown in Zumba\GastonJS\Browser\BrowserBase::command():

Server error: `POST http://127.0.0.1:8510/api` resulted in a `500 Internal Server Error` response:
{
    "error": {
        "name": "Poltergeist.StatusFailError",
        "args": []
    }
}

JavascriptTestBase->tearDown() kicks in oké, I see the commands running in PhantomJS.

andrewmacpherson’s picture

@dmsmidt - Can you upload your test anyway? I'm travelling at DrupalCamp Iceland just now, but I can probably find time to try running your test,

dmsmidt’s picture

Finally got my test suite working. Some networking error I think (See: https://github.com/ariya/phantomjs/issues/14272).

Here is a tests only patch with the existing unit test and the new functional test (should fail).

dmsmidt’s picture

Status: Needs review » Needs work
andrewmacpherson’s picture

Test failure for patch #38:

There was 1 error:

1) Drupal\Tests\inline_form_errors\Unit\FormErrorHandlerTest::testDisplayErrorMessagesNotInlineQuickEdit
Undefined index: #array_parents

/var/www/html/core/lib/Drupal/Core/Form/FormErrorHandler.php:132
/var/www/html/core/lib/Drupal/Core/Form/FormErrorHandler.php:23
/var/www/html/core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php:170

I think we need to declare #array_parents in FormErrorHandlerTest::testDisplayErrorMessagesNotInlineQuickEdit(), like we do in the other tests in the same class?

andrewmacpherson’s picture

Ooops, we're both online at the same time. Let's se if htat failure persists with #41

andrewmacpherson’s picture

Status: Needs review » Needs work

Patch #41 has:

+  public static $modules = [
+    'contextual',
+    'quickedit',
+    'node',
+    'inline_form_errors',
+  ];

Does contextual need to be here? I is a dependency of quickedit so would be enabled anyway.

andrewmacpherson’s picture

This patch:

  • removes contextual module from setUp in FormErrorHandlerQuickEditTest, because it's a dependency of quickedit
  • spilts users permisssions onto separate lines, there are 5 of them
  • adds #array_parents => [] to the test form in FormErrorHandlerQuickEditTest.php::testDisplayErrorMessagesNotInlineQuickEdit()
andrewmacpherson’s picture

Scheduling test against 8.3.x for good measure too.

dmsmidt’s picture

Woop green!

I think it would be great if we can get this committed to 8.3 and 8.4.
We can do a follow up about what I mentioned in #32.
It proposes a data model addition for 8.4, to disable IFE on a form altogether (should be possible in exotic cases like Quick Edit).
If that than gets in, we can then cleanup the approach in this patch (remove the quick edit specific part in IFE).

dmsmidt’s picture

Issue tags: -Needs tests
mgifford’s picture

I think we should have before/after shots for this.

dmsmidt’s picture

Updated the issue with before/after.
Is it just me, or is our error messages styling gone for QE in 8.4.x?
Anyhow, with or without IFE the output is now the same. Which is what we aim for in this issue!

dmsmidt’s picture

Issue summary: View changes
DamienMcKenna’s picture

Does this still need an issue summary update?

dmsmidt’s picture

@damien, well the summary is short, but says all. Removing the tag.

SKAUGHT’s picture

i've added an email field to basic article type
after activation 'Quick Edit' contextual link and then going down and clicking on Email filed. the phrase 'email ->gfdghfd' ( gfdghfd is the node title.) remains inplace, then the field will not validate.

i've rerun this without IFE enabled, and it produces the same error. so, there seems to be some other break with Edit. still, I'm noting this manual test.

dmsmidt’s picture

@SKAUGHT, so that problem seems unrelated to this issue. I've also seen some strange things happening with QE.
Can you confirm the goal of this patch at least is met?

SKAUGHT’s picture

yes. the patch does make Edit and IFE work together. The IFE message appeared without an inner hash link, as expected.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, so it seems there is nothing left here, right? Patch still looks good to me.

catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update
+++ b/core/modules/inline_form_errors/src/FormErrorHandler.php
@@ -53,6 +53,13 @@ public function __construct(TranslationInterface $string_translation, LinkGenera
+    // the errors are already near the form element.
+    if ($form['#form_id'] == 'quickedit_field_form') {
+      parent::displayErrorMessages($form, $form_state);
+      return;
+    }

I think it's OK for the patch to go in like this, but inline_form_errors should eventually be not-a-module whereas quickedit is going to stay one. So I think we need a follow-up to remove the hard-coded dependency.

Was going to suggest a .yml file with a list of form IDs, then we just check in_array()/isset() rather than hard-coding knowledge of other module's forms here. Or a custom $form['#property'] to check would be more lightweight.

#2848319: Find a way to make it easier to hide Inline Form Error messages on child elements was suggested as the issue for that, but not sure that's about this issue at all? Looks like it was talking about other bugs which are already fixed, might just need re-scoping though.

Might just need an issue summary update but it's not clear to me what the next steps are here.

dmsmidt’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community

We all totally agree we don't want module specific exceptions in the IFE module.

@catch in #32 and #47 I explained the next step, I created a follow up issue and added that to the issue summary.
As I don't see that you found any new problems with the patch, I'm putting this back to RTBC.

xjm’s picture

Thanks everyone! Great to see this RTBC. +1 for the followup; I agree with the goal of hotfixing this for 8.3.x and then coming up with a resilient and complete fix in 8.4.x. I've added the new followup to the overall roadmap as well.

I think this issue needs both usability and product manager signoff, given that it's the primary product concern for IFE and affects product integrity. Leaving at RTBC, because the product team join weekly usability meetings where they could review this as a group. I will let them know about the issue.

xjm’s picture

Version: 8.4.x-dev » 8.3.x-dev

Oh, since IFE is still alpha (though close to beta I think), we can also make this change during 8.3.x's RC.

xjm’s picture

Also, for what it's worth, the solution in this patch looks like an acceptable hotfix to me so long as we address the followup later (probably before we mark IFE beta, although I put it under RC on the roadmap). So if the product team agrees, I think we are on track for 8.3.0 with this fix!

Status: Reviewed & tested by the community » Needs work
xjm’s picture

Status: Needs work » Reviewed & tested by the community

It says tests failed but they did not; setting back to RTBC and retesting.

yoroy’s picture

I reviewed and compared situations with and without the patch. Ran into confusing behaviour of Quick Edit as captured in #2671202: [regression] Text field's label is duplicated in the value when edited & saved using Quick Edit but that's QE's problem. Updated the issue summary a bit. IFE's part in showing sane error messages in Quick Edit scenarios seems to be covered here. Thanks @dmsmidt.

xjm’s picture

Thanks @yoroy!

Since @yoroy was also involved in the usability and product review that prioritized this hotfix originally, I think that's sufficient signoff here and I overdid it with both tags. :)

xjm’s picture

Status: Reviewed & tested by the community » Needs work

@catch's review in #58 has also been addressed with #2856950: Add a possibility to disable inline form errors for a complete form.

It looks like #25.1 was never addressed though (using ===). Let's fix that and then get this in!

gaurav.kapoor’s picture

Status: Needs work » Needs review
FileSize
2.87 KB
3.43 KB
dmsmidt’s picture

Status: Needs review » Needs work

@gaurav, thanks but that interdiff looks a bit scary, you've removed the test. Could you please look at it again.

gaurav.kapoor’s picture

Assigned: Unassigned » gaurav.kapoor
gaurav.kapoor’s picture

Assigned: gaurav.kapoor » Unassigned
Status: Needs work » Needs review
FileSize
5.87 KB
688 bytes
andrewmacpherson’s picture

Status: Needs review » Reviewed & tested by the community

#72 is good. I made an interdiff 45-72 locally to confirm it.

Using === was the only outstanding issue in #68, so back to RTBC.

Gábor Hojtsy’s picture

Tested the patch and Drupal 8.3.0 RC1 without the patch. Looks like a clear improvement and also in line with what we discussed to be done at the UX meeting. Quick Edit is not changed when enabling Inline Form Errors because Quick Edit already displays errors near where the error is. Quick Edit itself needs to be made more accessible but IFE cannot help with that since the premise of displaying the error on the form element is not possible given Quick Edit removes the form element when you submit the form by definition.

Looks good from a product manager standpoint.

Updated screenshots.

Ps. this is my first Product Manager review. In reference to https://groups.drupal.org/node/516400

Gábor Hojtsy’s picture

Issue summary: View changes
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed ade9d78 to 8.4.x and f9925e7 to 8.3.x. Thanks!

All the feedback has been addressed and followups filed. Nice work everyone.

  • alexpott committed ade9d78 on 8.4.x
    Issue #2828092 by dmsmidt, gaurav.kapoor, s.d.sirois, andrewmacpherson,...

  • alexpott committed f9925e7 on 8.3.x
    Issue #2828092 by dmsmidt, gaurav.kapoor, s.d.sirois, andrewmacpherson,...
dmsmidt’s picture

Thanks all! And @Gábor congratz, big win for us all.

xjm’s picture

Issue tags: +8.3.0 release notes

I think we should mention this in the release notes, for two reasons:

  1. It's worth knowing that it's for now a design behavior for IFE not to happen with Quick Edit and that this opt-out will be offered for other forms later.
  2. It's also the last big requirement to keep IFE in core for this minor! Two other issues are still outstanding, but since this was the biggest remaining concern identified from the product perspective, I think we've accomplished what we need to keep the module in core for this minor. Thank you all! I will also follow up on the roadmap and tag that issue as well, so we can highlight the improvements to IFE in the 8.3.0 release notes.
kattekrab’s picture

So exciting to see this green :)

Congratulations and gratitude to all of you! Great effort.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rajeevku’s picture

rajeevku’s picture

I am still not getting errors , printed alongside quick edit.

rajeevku’s picture

andrewmacpherson’s picture

@rajeevku - we closed this issue before 8.3.0 was released, and the 8.4.0 release is expected soon. If you can reproduce you problem with 8.4.0-beta1, can you provide more detail in a new issue please?

Restoring previous tags - I'll still use these to find old accessibility issues after closing them.