Problem/Motivation
NoDisplay selection display does:
public function submit(array &$form, FormStateInterface $form_state) {
$this->selectionDone($form_state);
}
This means that every time an entity browser that uses this display is submitted the selection will be propagated. This works OK for single-step widgets where we can safely assume that submit also means that we completed the selection.
The problem becomes visible when using multi-step workflow which expects for selection to only be propagated at the end of the multi-step process.
Proposed resolution
Check if the main submit button was used to submit the form and only propagate the selection if this is the case.
Remaining tasks
- propose patch
- add test coverage
Comments
Comment #2
slashrsm commentedComment #3
ginovski commentedComment #4
ginovski commented1. Created test widget with multiple submit buttons.
2. Added default configuration for the widget.
3. Added test method in EntityBrowserUITest
Comment #6
slashrsm commentedI'd prefer if this test would be a javascript test. We have plenty of them that are doing similar things which should be a good example.
This permissions should be of the "access [entity_browser_id] browser pages" form. You should only need one.
This permission does not exist.
You need to step into iFrame in order to test things inside entity browser. There are many examples in the module.
You can add some dummy text to the widget and also check for the presence of that.
Missing required argument.
Comment #7
ginovski commentedAddressed #6, now a javascript method.

Tested it locally, works, not sure that test bot is also running js tests.
First asserting when clicking the second submit, that the second button is still visible (implicit check that the widget is open)
Then asserting when clicking the primary submit, that the second button is not visible (implicit check that the widget is closed).
Comment #8
ginovski commentedComment #9
slashrsm commentedMoved the test to a different, more appropriate, test.
Comment #12
slashrsm commentedCommitted. Thanks!