Problem/Motivation
The current workflow UI is very disjointed. Each link to Create, Update, or Delete a workflow state or transition takes the user off to a new page, which can result them getting lost, or at best a few clicks away from where they started.
Proposed resolution
As proposed in https://marvelapp.com/1124911 the new workflows UI is a unified single area for Creating, Updating, and Deleing workflow states and transitions.
Remaining tasks
User interface changes
Here's some screenshots of the state, transition, and delete modals based on #166:



API changes
Data model changes
Comments
Comment #2
jojototh commentedCross posting from https://www.drupal.org/node/2779647#comment-11821941
Here is a new prototype for workflow:
- keeps the same functionality and technical implementation
- user doesn't leave page before workflow and moderation configuration is done as it all happens on same page instead of 4 different pages - reduces the amount of clicks and pages needed
- simplifies the UX and reduces "up to 25%" of time needed for creating and administering workflows and moderation
- improves the Workflows listing by showing important information such as workflow type, which entity types it affects and states available
Below is a video comparing creating workflow, 1 new state and 1 new transition and configuring moderation for 1 content type in the current and proposed versions.
Video: https://youtu.be/xB-AbupfDxY
Interactive prototype: https://marvelapp.com/1124911
Comment #3
tacituseu commentedIn my opinion (long term) it would be great if the UI would mirror how the comments work, by which I mean:
1. configure 'Workflow types' under '/admin/structure'
2. add field of type 'Workflow' to the bundle under 'Manage fields' and pick one from step 1
Then allow only one of them to have control over submit button (configurable under 'Edit field settings' on 'Manage fields' tab)
Not sure it's in the scope of this issue, looks more like it's meant to be a minor clean-up of what went in. Opened #2835545: Provide a Workflow FieldType that references a workflow entity and tracks the current state of an entity for this direction.
Comment #4
andypostComment #5
timmillwoodOpened #2843083: Select entity type / bundle in workflow settings to work on some of this.
Comment #6
alexpottOne of my concerns with the currently proposed prototype is that it will only work nicely on sites with a limited number of entity types and bundles. 20+ content types are not unheard of.
Comment #8
timmillwood@alexpott - Are these concerns from a UX or performance point of view? It seems unanimous from the UX site that the selection of entity types and bundles a workflow can be used on needs to move out of the bundle settings. In the latest UX call (https://youtu.be/xWLXFRbs-EM?t=245) Kevin O'Leary expressed concerns about how deep the setting was.
Comment #9
Bojhan commentedWithout a 'new' form element I am unsure how to resolve @alex his issue. The only suitable pattern we have would be the way we present fields for selection, in the Views UI.
Comment #10
tkoleary commentedSo my comment is not about the entity types bundles thing but more about the general wall of information effect that this UI is presenting. I think it would be great if we could get to a simpler UI that folds together a lot of the tasks that have been pulled apart here into their own discrete feildsets, modals etc.
The one that's been bugging me the most is the transitions UI because I believe it may be the most difficult for people to wrap their heads around. I made this codepen in an effort to work out a UI that would do this without adding too much front-end code. Here's what it looks like:
And here's the link to the codepen prototype: http://codepen.io/tkoleary/pen/EWEXWQ?editors=1100
Setting aside the entity types, this is really all the UI you need to for 80% of tasks. The tabs across the top I envision just loading the next transition into the same space via ajax. The "add transition" button-link could behave the same way, and the "add state" button-link could also load in place or via a modal. The important thing is that it will bring the user right back to this visualization.
The important thing is that I can quickly flip back and forth between the transitions and follow the selected states and the leader lines to see which states are going to where.
I also get a description that tells me what's going to appear in the button, because otherwise I have to—in my head—go "Ok the button always says 'Save and' so My label needs to be 'save and something' but without the 'save and'"
Comment #11
timmillwoodI really like the idea in #10, but do wonder if it'll be unfamiliar to Drupal site builders. The current workflows edit form is very similar to many other admin pages within Drupal. Just my 2 cents.
I actually came here to close this issue in favour of #2843083: Select entity type / bundle in workflow settings which is implementing @jojototh's designs from #2 and nearing completion. Forgot about #10.
This is currently a "must-have" for Workflows to become beta (#2843494: WI: Workflows module roadmap) so looking to action on that.
Comment #12
tkoleary commented@timmillwood
That is true, but the first question we should be asking is whether it's a simpler and more understandable pattern for *any* user, brand new or experienced with Drupal. We shouldn't willy-nilly introduce new patterns into core, but there are instances when core patterns are insufficient. Given the complexity of the mental model her I think this is one of those instances.
Having said that, this pattern is so new that it does warrant some usability testing.
Comment #13
Bojhan commentedCan we centralise the issue that we discuss that UI in? I've seen it in another issue too.
I am very keen on introducing new UI's, we try to fit everything into tables - especially with sequential things like this, its just the best fit. I am very much in agreement with Kevin on this one, a new pattern in this case may be a better fit.
Comment #14
timmillwoodok, but does this still need to be a "must have" in #2843494: WI: Workflows module roadmap?
Comment #15
jojototh commentedI think that Kevin's proposal is actually trying to achieve the same thing as I originally proposed for Workflows, but it wasn't yet implemented. See the proposal at: https://marvelapp.com/1124911/screen/17578780
Comment #16
vijaycs85Initial patch on proposal in #15
Patch contains:
1. Implemented only for transition edit and add link
2. Updated "to" to selectbox
Yet to do:
1. Apply to other elements. If the implementation is OK.
2. On validation error, going back to page
3. Probably fix alignment issue on loading icon (ref: screenshot)
Comment #17
manuel garcia commentedGreat stuff @vijaycs85!
Took the liberty to continue where you left off =)
Still to do (at least):
Comment #18
timmillwoodHere's some details on how to get the form errors to display, https://api.drupal.org/api/drupal/core%21core.api.php/group/ajax/8.2.x#s...
Comment #19
manuel garcia commentedMore progress on this:
Still to do:
Comment #20
timmillwoodThe delete link it inherited from EntityForm, I'd be happy to remove it so the only place to delete it a drop button on the workflows page.
Comment #21
manuel garcia commentedSome more progress...
Still to do:
Comment #23
manuel garcia commentedCouldn't help myself, so I did the same for the workflow states:

In my opinion we should remove the operations links on the transitions table from
WorkflowStateEditForm::form(), since it wont work well on a modal context, and we can already edit them below without leaving the same page... thoughts?Comment #25
manuel garcia commentedFixing the failing test (we removed the delete link from the edit form), and some coding standards violations.
Comment #26
manuel garcia commentedMy take on fixing the throbber on these kinds of buttons, not sure if we should do this as a separate issue, if so the interdiff could easily serve as the starting patch.
Comment #27
vijaycs85Looks great.
minor: CS issue: Short description should be < 80 character
minor: CS issue: empty line between @param and @return missing
Comment #28
timmillwood#27.1 - maybe we need a
WorkflowFomBaseor similar to inherit shared methods.Comment #29
manuel garcia commentedThanks for the reviews - fixing CS issues mentioned in #27, reviewed the rest of the patch with that in mind, and adding proper titles to:
As far as adding a base class for all these forms, do you think it's time to start optimizing this?
Should we have a base form for edit, a base form for adding, etc?
For now I can only see an obvious method that could be reused
cancelAjaxCallback(), and perhaps strip out the error handling part ofsubmitAjaxCallback()somehow...Comment #30
manuel garcia commentedRerolled, there was a tiny conflict on core/themes/seven/css/components/dropbutton.component.css
Comment #31
manuel garcia commentedOK I did a bit of refactoring, introducing
WorkflowFormBase. BothWorkflowTransitionEditFormandWorkflowStateEditFormextend it.Was able to pull out
actions(),cancelAjaxCallback()and the error handling part ofsubmitAjaxCallback().Unfortunately
cancelAjaxCallbackis stil duplicated on the delete forms, but since those extendConfirmFormBase, they can't useWorkflowFormBase, which extendsEntityForm. So perhaps there is a better approach.To be honest, I think
WorkflowFormBasecould be used for editing any entity in a modal in theory...Comment #32
timmillwoodMaybe a trait would make more sense.
Comment #33
timmillwoodI think we should go down the route of adding a trait, and add it to
/core/lib/Drupal/Core/Form.Comment #34
manuel garcia commentedThanks @timmillwood for the help on this one, introducing
Drupal\Core\Form\ModalFormTrait, instead ofDrupal\workflows\Form\WorkflowFormBase.interdiff.txt is against #31 which introduced the base form, so probably not terribly insightful to look at.
interdiff-30-34.txt is against #30 which is perhaps better to see the effect of introducing the trait itself.
Comment #35
manuel garcia commentedIntroducing functional javascript tests:
core/modules/content_moderation/tests/src/FunctionalJavascript/WorkflowTypeEditFormTest.php- tests for what we introduced on #2843083: Select entity type / bundle in workflow settings.core/modules/workflows/tests/src/FunctionalJavascript/WorkflowEditFormTest.phptests what we're trying to do on this issue. Not finished yet.These led me to discover that we weren't attaching the
'core/drupal.dialog.ajax'library to WorkflowEditForm so doing this as well.I am blocked on
WorkflowEditFormTest::testWorkflowTransitionsForm(), which fails saying thatRuntimeException: Unable to complete AJAX request.when trying to save the transition edit form. It has driven me slightly insane: it is identical to the states edit form test, except updating a checkbox field as well as the label. However i have tried the test without updating the transition at all and it still fails. Any pointers would be very welcome!Comment #36
manuel garcia commentedSelf review:
This should be edit-transitions-modal-messages, but im not testing this yet so my blockade remains.
Comment #38
manuel garcia commentedFixing #36 while I'm at it.
The test results at least show why the ajax request doesn't finish, however, that looks to be an unrelated bug to what I'm trying to do?
Error: Syntax error, unrecognized expression: [data-drupal-selector="edit-transitions-publish-to]Comment #40
manuel garcia commentedOK I'm such a retard sometimes haha
Yes its totally related to what I'm doing, and yes, it is totally my fault!
Tests should come back green now, I'll work on expanding the coverage now.
Comment #41
manuel garcia commentedAdding tests for deleting a transition, and cleaning up a bit the rest of assertions. With this I think I'm finished with the JavascriptTests =)
Comment #43
manuel garcia commentedFailure seems unrelated, fixing coding standards in the mean time...
Comment #44
manuel garcia commentedOops, wrong patch.
Comment #46
timmillwoodThis is looking pretty close and so tempted to RTBC, but one thing is bugging me.
When editing a workflow state (in a modal), clicking the edit or delete link for a transition reloads the page. I think this should close the state modal and open the transition modal.
Comment #47
manuel garcia commentedRe #46: If you take the route of editing the transition in a modal from there, then when you save the transition, the user would expect to be back where you started (the state edit modal), and that is going to get very complex if at all possible currently.
This would be doable perhaps if we had nested modals working, which we unfortunately don't (see #2741877: Nested modals don't work: opening a modal from a modal closes the original)
I agree that this part needs some kind of decision on what to do. I proposed this on #23:
Comment #48
gábor hojtsySince the issue clearly went quite forward from *reviewing* the UI, let's update the issue summary/title with clear goals, so we can tell when this is done. As it is now, it is entirely open ended. As a must-have issue for #2843494: WI: Workflows module roadmap, we should have clear goals. If certain things are defined while others need more definition that should be documented too.
Comment #49
timmillwoodUpdating the title and issue summary to reflect that we are now at the stage of implementing everything suggested in #1.
Comment #50
timmillwood@Manuel Garcia - ok, I think removing the edit and delete links for transitions within the state modals sounds good. The mock ups in #1 doesn't have them.
Comment #51
manuel garcia commentedRemoving the transitions table from the states edit form to reflect what we have on #1.
Also noticed we were adding the attributes twice to the Add a new state link, so removing that from the patch.
Comment #52
timmillwoodNice, will RTBC once we have screenshots.
I'll do the screenshots (or animated gif) when I get chance, but anyone is welcome to generate them.
Comment #53
manuel garcia commentedWhile doing the screenshots i realized that if you generate a form error on the transition / state add forms they take you to their add page (for example admin/config/workflow/workflows/manage/editorial/add_transition)
This totally breaks the flow... so we need to do the submit on the add forms via ajax and display any errors that way.
Working on that
Comment #54
manuel garcia commentedOK now the form submits via ajax, displays the errors if any on the modal, and if there are none, it saves and redirects to the current workflow edit form.
I avoided closing the modal because otherwise when the page reloads it looks funky. Like this you just see the loading icon and then the page reloads.
Comment #55
Bojhan commentedThanks for all the work, this looks really interesting.
From my understanding of this thread at #15, we diverged from the conversation and went with a solution proposed by jojototh using tables as a way to form the states, transitions and applied entities. This is in line with much of core.
I would like to challenge the thinking that this is sufficient for RTBC. The concepts in this screen are complex and the user needs to be guided how to effectively set things up, the fact that very different concepts look homogeneous implies linear sequence and equal importance. While in reality there is an interplay between states and transitions (at least) and this can easily become quite complex.
Can we explore having at least a representation of the states and transitions, like proposed in #10 by tkoleary? I understand making it interactive is a challenge, but the representation will greatly improve the usability.
Comment #56
Bojhan commentedThis would be the review for now, will happily provide more context. From the usability perspective, this is not close to RTBC.
Comment #57
sam152 commentedInitial high level code review of #54. Reviewed the code before seeing the suggestions made in #55, but I think that comment and this one is enough for NW.
First line should be 80 chars.
Why are these methods not camel case?
Is it necasary to cache these? 40 occourances of "$this->assertSession();" in core vs 330 "$this->assertSession()->"
This appears a few times in core. I wonder if some constants for standard modal widths would be useful.
Why not use double quotes to enclose the single quotes.
Seems cleaner to check form_state for errors here.
Can all of this be avoided by sending a RedirectCommand which reloads the page?
Maybe something like \Drupal\Component\Utility\Html::cleanCssIdentifier could help us here.
Does this string need work. "Edit the Draft state for the Editorial"?
Same here.
Same here.
Comment #58
jojototh commented@bojhan thanks for the feedback! I gave it a few thoughts and found some concerns with what tkoleary proposed in #10 that need to be figured out:
Here is an option, that could benefit from tkoleary's proposal and answer the concerns above
Comment #59
timisoreana commentedComment #60
manuel garcia commentedThanks for testing!
Those were probably errors from previous form submissions, but with the latest patch that should not happen since we are already displaying them within the modals. Did you get this with the latest patch (#54) applied?
Comment #61
timisoreana commentedYes, Manuel, it was the latest patch (#54).
These errors, as you said, are shown within the modals, but only when user clicks "Save".
But,
when user clicks "Cancel" and refresh the page he will see these errors (anyway, no need to show errors in this case, no matters on the page or modal).
You are welcome if you have the questions).
Comment #62
manuel garcia commentedThank you @timisoreana for kindly explaining, I will check why this happens when we have a consensus around the UI and I get back to this patch.
Comment #63
timmillwoodIn #2850549: Allow changing of transition 'to' on edit we talk about changing the "to" state of a transition. Therefore here we need to assume the "to" state cannot be changed, then handle in the other issue if and how we allow it to be changed.
Comment #64
timmillwoodWe discussed this issue in the UX call today.
Gabor suggested we move forward with the direction Jozef originally proposed here. Then open a new issue regarding the proposal in #58. Thus we get the initial improvements in, and they don't end up getting derailed and delayed with discussions about the new transitions interface.
Comment #65
gábor hojtsyFor the record (and anyone can watch the actual recording literally at https://www.youtube.com/watch?v=7afbnHveAJA :D) I said if we agree that using these modals is the best way forward then getting the modals committed as a first step would be best so we can work on refining the *content* of the modals later on. I think introducing the modals and refining the content of the modals in the same issue may result in unfair coupling, hard to review patches, etc. and the modals may not end up in core if we don't end up being able to solve the rest of the technology or argue endlessly about it.
If we don't agree the modals help and there is a more holistic improvement needed not "just" refining the contents of individual pages after they are made modals, then it does not help to commit modals first.
Comment #66
manuel garcia commentedOK then, worked on stabilizing what we have so far:
Re #57:
1. That line is 72 chars, if I added the next word to it it would go over 80. That said I have reworded that so it makes a bit more sense as to what it does.
2. Fixed
3. Done
4. I chose that width because of that, for example its what's used on the block configuration page. Also works in this case fine.
5. Removed the single quotes, we don't need them and we aren't using them on the sates forms either.
6. Yep you're right, fixed.
7. Yeah I agree, updating all the ui in ajax calbacks is getting very messy. I've reworked all submit ajax callbacks so they first display any errors in the modal if there are any and then reloads the page using a RedirectCommand.
8. No longer necessary since we are reloading the page instead of updating the ui via ajax.
9, 10 & 11. The Editorial workflow is actually called "Editorial workflow". If I add ' workflow' to the string, its going to end up displaying: Edit the Published state for the Editorial workflow workflow. This is an ongoing problem in content_moderation, and we should fix this as a different issue in my opinion, because it probably has an effect on a lot of other different strings.
Re #59.2 - Fixed
So a lot of changes, patch should come back complaining about
WorkflowEditFormTest, but I wanted to get this up and see if anything else breaks. Nice that this way the patch is smaller though :)Comment #68
manuel garcia commentedRefactored the tests to actualy just test the js functionality (modals and in-modal form errors), however im getting strange errors locally:
Zumba\GastonJS\Exception\BrowserError: There was an error inside the PhantomJS portion of GastonJS.Uploading to see if its just me.
I also fixed a bug introduced in #66 which I found by the new tests =)
Comment #70
manuel garcia commentedOK so its not just me... anyone seen this before?
Comment #71
tacituseu commentedPerhaps #2773791: Clicking elements with children in Javascript tests throws a GastonJS exception ?
Edit:
Failing at
$this->click('#edit-states-container tr:contains(Published) button .dropbutton-arrow');Comment #72
manuel garcia commentedThanks @tacituseu
OK that selector makes no sense because Published does not have a dropdown button. Duh.
Switching it now to using the Archived state, which does. However the test still fails :S
If I run (with the new selector)
jQuery('#edit-states-container tr:contains(Archived) button .dropbutton-arrow').click();on the js console, and the dropdown shows the delete button properly, so the selector apparently should not the problem now?I also tried applying the patch on that issue as well, but the tests still fail :S
Other selectors I've tried (both work on the js console):
'#edit-states-container tr:contains(Archived) .dropbutton-toggle button''[data-drupal-selector="edit-states-archived-operations"] .dropbutton-toggle button'Comment #74
tacituseu commentedMight be the reason
Drupal\Tests\views_ui\FunctionalJavascript\FilterCriteriaTest::testFilterCriteriaDialog()does it like this:Comment #75
manuel garcia commentedThanks @tacituseu again for helping me out debug this.
It ends up that the selectors weren't the problem. Instead it had these two problems:
So, in this patch:
Comment #77
manuel garcia commentedArgh, ignore the patch on #75 its just the interdiff with a different name, sorry bot! So the interdiff on #75 applies to this one.
Comment #78
manuel garcia commentedSelf review: we should probably merge
Drupal\Tests\workflows\FunctionalJavascript|WorkflowEditFormTestintoDrupal\Tests\content_moderation\FunctionalJavascript\WorkflowTypeEditFormTest.Comment #79
manuel garcia commentedRe #78: actually as @timmillwood pointed out, one is for workflows and the other is for content_moderation so it's probably fine as it is...
Comment #80
manuel garcia commentedFinalized the test that handles the 'This workflow applies to:' section.
It now also checks the UI updates that happen when you change the selection of entities that the workflow applies to, both adding and removing selections. With this I think we are well covered when it comes to JS tests for what's going on on this page.
Comment #81
timisoreana commentedClick on Cancel button doesn't close the modal.
Steps:
ER Modal should be closed
AR: Modal is not closed video
Was applied patch #80
Comment #82
manuel garcia commentedThanks for testing and the report @timisoreana!
Apparently setting
'#limit_validation_errors' => [], on the cancel buttons is causing some issues... its preventing validation which prevents the form errors, but apparently the form is still being submitted, and triggers this as it thinks the user is trying to save the form:setTransitionFromStates()is only being called fromDrupal\workflows\Form\WorkflowTransitionEditForm::copyFormValuesToEntity(), which I'm not sure why its being triggered. The cancel button is just a button, not a submit button... any pointers welcome!Comment #83
timmillwoodThe entity gets built no matter if the submit is happening or not, so what we need to go is ignore the exception, and depend on form validation, we could do this with a try / catch similar to the patch in #2886567: Adding a workflow state or transition with an integer ID results in unrecoverable fatal errors.
This should do the trick:
Comment #84
timmillwoodIt looks like the follow up to implement the design from #58 is #2758623: [meta] Redesign workflow configuration page to better visually describe the flow.
Comment #85
manuel garcia commentedThanks @timmillwood makes sense, doing so in this patch, which fixes the bug.
Comment #86
manuel garcia commentedAdding test coverage for what was fixed on #85.
Attached a test-only patch which should fail (doesn't include the interdiff from #85), and a patch with both the fix and the test.
Comment #88
timmillwoodAwesome work on this @Manuel Garcia!
Comment #89
manuel garcia commentedSpecifying the type of exception we're catching on
WorkflowTransitionEditForm::copyFormValuesToEntity(), and applying the same fix on the transition add form, where we had the same bug.Comment #90
manuel garcia commentedSwitching back the transition add form to field to its original radios type (out of scope change)
Adding explanatory comments to the try/catch on copyFormValuesToEntity, and cleaning up an old unnecessary @todo.
Comment #91
timmillwoodLooks better.
I quite like the try/catch approach to bypassing the exceptions to get the form api validation. We could equally duplicate the validation, but not sure we want to duplicate things.
Comment #92
tstoecklerHmm... I'm not excited by the try-catch, as I've mentioned elsewhere in particular because we already decided on the other approach in the other issue. What bothers me even more, though, is that with the patch we have an inconsistency in the validation between e.g.
WorkflowStateAddForm::copyFormValuesToEntity()andWorkflowTransitionAddForm::copyFormValuesToEntity(). I really don't think we can commit it like this. I think we should either copy the validation for now and then @timmillwood you can open a follow-up to discuss to change that into a try-catch (for both forms) or we use a try-catch for both foms directly, but then we would need e.g. @Berdir to RTBC as a "tie-breaker" between @timmillwood and me. Kicking back to "needs review" for now.Comment #93
timmillwoodThe other issue where we're implementing a try/catch is #2886567: Adding a workflow state or transition with an integer ID results in unrecoverable fatal errors. I do like it because I am a firm believer in keeping the code D.R.Y, but we could have some validation method, or just a method that returns the regex to help this, try/catch just seemed like a simple solution.
That being said, I think we do need consistency between the State and Transition forms.
@berdir taking a look sounds like a good idea. ;)
Comment #94
plachOne minor thing:
Can we store the default dialog attributes in a variable to ensure we have to change them just once, if needed, and no inconsistencies are introduced?
Comment #95
manuel garcia commentedAddressing #94
Comment #96
manuel garcia commentedI just realized that since we are reloading the page when submitting the modal forms instead of updating the UI on the ajax callbacks, we no longer need to change those parts of the form in order to have markup to target.
Removing those changes in this patch which should make it slightly smaller...
Comment #97
timmillwoodPatch looks good to me, but we still need to argue about the try/catch Vs. replicating the validation.
Comment #98
plachRight, let's try to summon @Berdir then.
Comment #99
manuel garcia commentedOpened up #2894499: Rename 'Editorial workflow' to 'Editorial' in order to be able to address #57.9, 10, and 11 properly.
(See my reply to it on #66).
Comment #100
berdirSorry for the delay.
I'm not sure. Neither duplicating the validation nor the try/catch will really help us long term if we want to handle config entity validation like content entities, that is, validate using the validation API/config schema. Which we will need if we want to support REST for them.
But we also have problems there with content entities, for example #2820364: Entity + Field + Property validation constraints are processed in the incorrect order.
I don't really have a preference for try/catch or duplicating the validation. Having a @todo + follow-up seems like a good idea, and if I understand it correctly, if we'd do #2886567: Adding a workflow state or transition with an integer ID results in unrecoverable fatal errors then both forms would use try/catch and would be "consistent"? So I think I'd be ok with the try/catch in both issues and a follow-up to figure out a better solution.
Comment #101
berdirAs an idea, we could handle things like this by changing the entity validation in entity forms in a way that would only build and validate the entity if there are no form-level validation errors. Then we could have #element_validate and similar things for elements that could break an entity just by setting them. And rest could possibly introduce a pre validate method or something that would allow entities to inspect the raw values before they are set? Or we'd define a special exception interface that rest would be able to handle in a meaningful way.
Comment #102
timmillwood- Created follow up #2895310: Building entities in ContentEntityForm::validateForm() can throw exceptions to fix entity validation in regards to forms as @berdir suggested in #101.
- Added @todo to the patch pointing to the follow up.
Comment #103
plachOk, leaving RTBC to @tstoeckler.
Comment #104
xjmThe title of this issue terrifies me every time I look at the roadmap, so trying to give it a more descriptive title based on my understanding. :) The summary could use an update with some more detail and screenshots, also.
Comment #105
xjmIdeally, the ModalFormTrait would be adde in a separate issue, with its own tests etc., since it is a new API.
Comment #106
tstoecklerOK, don't want to hold this up any longer. And yes, it's not ideal either way. So let's do this!
Comment #107
tstoecklerOh wait, did #104 want to set this to needs work to update the issue summary? Either way, this is fine by me.
Comment #108
tim.plunkettSomeone pointed me to this issue an hour ago. It adds a new public API to the Form subsystem.
I haven't had a chance to review it yet.
Comment #109
timmillwoodJust to note, we could do this without the new api or trait, but it seemed to make sense.
Comment #110
xjmPer @tim.plunkett and @tedbow, this is adding a trait that's very similar to (but not quite the same as) one added in #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page, so I do think we should split that trait out into a new dedicated issue so it can be reviewed and used for both. Also since it should have test coverage. (Since the proposed trait is an addition for stable core, we want to get it in sooner than the improvements for the two experimental modules.) Thanks!
Comment #111
tedbowI am working on seeing I get 1 trait to working for both issues
Comment #112
tedbowOk is here is try at using most of the trait here #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page to work on this issue.
Here is what I did
I am just about to update #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page with the exact same trait.
Comment #113
tedbowRealized I didn't override buildForm in WorkflowTransitionAddForm
Comment #114
timmillwoodIt seems like this issue has broken the form actions, as we now have a "delete" showing up on the state edit form when it shouldn't, and it also seems to be linking to the wrong place.
Comment #115
xjm@timmillwood, the patch in general, or @tedbow's work on the trait? Something that needs tests either way I think.
I still really think we should put the trait in a dedicated issue since it's a separate concept in a different (stable) subsystem. But we can validate here first that the modal is working correctly for this usecase before splitting it off.
Comment #116
timmillwood@xjm It's @tedbow's patch in #112, previously we were overriding the EntityForm actions method, the #112 patch reverts this.
Comment #117
tedbowOk this updates the trait to this #2785047-57: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page
It allows passing the CSS selector of the dialog, defaults to modal selector which this module uses.
Comment #118
manuel garcia commentedThe modal forms are redirecting to
config/workflow/workflows/manage/editorial(its missing the admin/ chunk).The edit forms are now showing the delete links (we were removing them):

The add forms are also showing delete links (they shouldn't):

Comment #119
timmillwoodComment #120
timmillwoodThis patch introduces WorkflowEntityForm which has common methods used by 4 of the workflow forms, such as actions, fixing the delete link issue.
The redirect issue is fixed by an update to \Drupal\Core\Form\DialogFormTrait::submitFormDialog which @tedbow seems to be having issues with when running Drupal in a sub directory. The code is similar to that used in \Drupal\Core\Form\ConfirmFormHelper::buildCancelLink, so should work for all unless we have an issue there too.
Comment #121
tedbowWanted to mention here that @effulgentsia was reviewing #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page which using this trait and suggested that we might not want to use a trait all. See comment and my reply https://www.drupal.org/node/2785047#comment-12175310
Comment #122
tedbowRE #120
I am still getting a page not found when the I use the State edit form in the modal.
I get redirected to http://www.d8.dev/d8_3_rest/d8_3_rest/admin/config/workflow/workflows/ma...
Notice my sub directory d8_3_rest is in their twice.
I know the test bot runs in a sub directory so I check I and I don't there is JS test that actually saves this form in the modal.
WorkflowEditFormTest just checks the form and that validation errors show.
I think if the test coverage was added this would show the failure.
Will try updating the trait here #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page because there is test for the redirect on save. See if it indeed fails
Comment #123
tedbowWeird "q" at the end of line. I probably did this.
Comment #124
sam152 commentedManual reviewing the UI, this is looking really cool. One interesting observation (which is probably entirely follow-up or wont-fix territory) is that hitting "Cancel" gets a "close modal" command from the server and then does it's thing, but the actual "X" button at the top right of the modal has a way to dismiss it instantly. I wonder if we can use the same mechanism on both buttons.
While the trait is being discussed, I've reviewed all the non-trait code. There are a few standards violations that the patch introduces, which we can fix in a round of nits once the patch is ready.
If we aren't intending on use this form as it is and it's designed to be extended, should possibly be called "WorkflowEntityFormBase" or be made abstract. If its primary function is making the other forms that extend it modal-friendly, possibly should indicate that in its name too?
Some better docs here maybe?
If the base uses the trait, do we have to use it again on the classes that extend it?
Once #2894499: Rename 'Editorial workflow' to 'Editorial' gets in, this will read "Add a new state of the editorial". Just something to be aware of.
Comment #125
manuel garcia commentedExpanding WorkflowEditFormTest for covering submitting the edit and delete transition&state forms, and verifying that we are still on the same path and the right message is shown.
Comment #127
timmillwoodIn #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page it was decided not to use a common trait, so here's a patch moving the trait back to Workflows, but with many of the advances we've seen since the last workflow specific trait.
Comment #128
tim.plunkettPer RedirectCommand's constructor, this should have a ->toAbsolute() call before the ->toString()
Removing the tag I added when this was touching \Drupal\Core\Form
Comment #129
timmillwoodThanks @tim.plunkett!
Comment #130
manuel garcia commented#2894499: Rename 'Editorial workflow' to 'Editorial' has landed, so we should now do #57 9, 10, and 11
Comment #131
manuel garcia commentedFirst a reroll, manually fixed conflicts on:
Comment #132
manuel garcia commentedAnd here the changes adjusting the workflow strings due to #2894499: Rename 'Editorial workflow' to 'Editorial'. Fixes #57 9, 10, and 11 - I also searched for "@workflow" in order to find other possible places to fix.
Modified:
Comment #133
tacituseu commentedComment #134
tedbowIs this necessary anymore? I think I added this change when the trait was in #2896535: Create a helper trait for Forms in ajax dialogs but since this trait is only used inside the workflow module now this will never be used.
If it is removed you won't have the need for test coverage for different dialog types.
Are there case in the workflow module where there will not be a "submit" button? a "cancel" button?
If not these if statements and $ajax_callback_added could be removed.
Does the event need to be specified here? Will it work without it?
It maybe better to use data-drupal-selector rather id for replaement as we did in #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page but you want to look at that patch to see how we got around #2897377: $form['#attributes']['data-drupal-selector'] is set to a random value so can't be used for its intended purpose
This should only need to check for "drupal_modal" now that is trait only used within Workflow and only used in modals and not other types of dialogs.
Also I think having "drupal_ajax" could be a problem because this would pick up a ajax callback even if the form was not in dialog.
We solved by sending the dialogType back on submit. See the interdiff here #2785047-70: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page.
Looks like the WorkflowEditForm still uses the query string destination logic I added in previously but the trait itself is now not using it for a redirect. I think it can be removed from the form.
Comment #135
manuel garcia commentedThanks @tedbow for the review!
First a reroll, manually fixed conflicts on:
Comment #136
timmillwoodI'm nearly done fixing the issues raised by @tedbow, patch coming soon!
Comment #137
timmillwoodFixing all items mentioned by @tedbow in #134.
Comment #140
manuel garcia commentedUpdating the patch due to #2849827: Move workflow "settings" setters and getters to WorkflowTypeInterface, and fixing coding style violations found by the bot.
I think however that displaying the form errors on the modal forms no longer works so this should still fail.
Comment #141
timmillwoodFixing the error messages in the same way as #2785047: In Outside In mode, form validation messages should appear in the off-canvas tray, not the main page.
Comment #144
timmillwood#141 fixes the failes from #140, but the #141 fails looks to be unrelated.
Comment #145
tedbowok I think only #134.3 was the only remain item from my review.
So fixed in this patch. Let me know if we need "click" event specified.
The other changes to this patch are test related.
#141 was NOT failing on DrupalCI but was failing for me locally.
Ajax dialog testing is tricky and we have seen a lot random failures on DrupalCI. but problem is usually works locally but doesn't on DrupalCI which is the opposite of what I am seeing now.
@see #2870146: Even more random fails in \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest
#2830485: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly
and #2848177: More \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest random fails
Most of these revolve around waiting for events to happen
I think this cause of my local fails
assertWaitOnAjaxRequest is tricky with ajax redirect. I think what is happening locally is that that assert passes without the redirect being done.
Then the path 1 passes and the last one fails.
I have changed this to not worry about ajax all and just wait for the "saved" method to appear on the page and then check the path.
Comment #146
manuel garcia commentedThanks @timmillwood & @tedbow!
While I see how this method makes the tests easier to follow, can't help but think that this would also be useful on other situations... let's find a better place for it... perhaps
JavascriptTestBase?Comment #147
tedbow@Manuel Garcia should we make a follow up to add assertElementVisibleAfterWait \Drupal\FunctionalJavascriptTests\JSWebAssert where waitForElementVisible lives.
Comment #148
manuel garcia commented@tedbow follow up to move it to
JSWebAssertmakes sense to meComment #149
timmillwoodThanks for the patch update @tedbow, looks RTBC ready to me!
Comment #150
tedbowcreated #2898777: Add assertElementVisibleAfterWait to JSWebAssert
@timmillwood yes looks very close.
Comment #151
tedbowAdded to @todo to remove assertElementVisibleAfterWait after #2898777: Add assertElementVisibleAfterWait to JSWebAssert
Comment #152
timmillwoodI think this is looking good now, thanks @tedbow.
I'm going to RTBC, but think this needs a +1 from @tedbow and / or Manuel as I wrote a lot of the patch.
Comment #153
tedbowWe no longer need either 1 of these parameters to this function
Otherwise than that +1 on RTBC
Comment #154
tedbow#153 whoops I was confused with closeDialog() in another version I was working. closeDialog() is an ajax callback so we should leave those parameters.
RTBC!
Comment #155
manuel garcia commentedHad a read through the patch, looks great.
Applied it and had did some manual testing, everything looks awesome +1 to RTBC
Comment #157
manuel garcia commentedComment #158
sam152 commentedStraight up reroll.
Comment #159
sam152 commentedComment #160
manuel garcia commentedThanks @Sam152!
Back to RTBC assuming patch comes back green :)
Comment #161
sam152 commentedHere are some questions and nits I picked up reviewing this. Some of them are borderline style things, but I think a few of them would probably hold up commit if reviewed by a core committer.
Would this be an easier commit if this was in its own issue? It's new tests for a feature that we already have, not introduced in this patch right?
May as well use "assertEquals" so we're not introducing deprecated method calls.
Missing full stop.
Why not just call $response->addCommand() twice and return "$response" instead of introducing $command.
I don't think this ever returns a bool and the method doesn't display validation error messages.
Can we be a bit more descriptive here?
I think this violates cs.
I think this violates coding standards, or at the very least isn't accepted practice.
I think this violates coding standards.
Lets be consistent with large array arguments we use in this whole file.
Maybe we can describe this better.
May as well just return here.
This could have been an error in the re-roll. Also, is this a general improvement or something specific to the modals? Seems possibly out of scope.
Edit: yup, I definitely botched the reroll, and the tests failed so this is in-scope.
Extra new line
Do we have to do two waits here?
Double newline
Comment #162
timmillwood#161.1 - This patch is not just about adding modals, it's about bringing consistency on the Workflow edit form. These tests are testing that consistency. I don't think there's any harm in adding them here.
#161.2 - Fixed
#161.3 - Fixed
#161.4 - Yeh, that works, done.
#161.5 - I think you're right.
#161.6 - Yes we can.
#161.7 - Updated, just incase.
#161.8 - ok
#161.9 - ok
#161.10 - Went through all uses of
fromRoute()to make sure they all use the same syntax.#161.11 - Tried.
#161.12 - yes
#161.13 - Fixed
#161.14 - Where?
#161.15 - Not sure? @Manuel Garcia or @tedbow?
#161.16 - Where?
Comment #163
manuel garcia commentedThanks both, great stuf!
Re #161.15 I believe we do... the first waits for the ajax request to happen, then the element has to be rendered before the element is visible... we could run into strange failures at times if we don't do this as far as I understand.
Comment #164
tedbowre #161.15 yes would recommend leaving the 2 different waits.
assertWaitOnAjaxRequest()also checks for animation as well ajax request finishing.We have run into a lot of random failures trying to figure out when dialog show up in the settings tray module see #145.
I think we want to leave
assertWaitOnAjaxRequest()to make sure the ajax request is completed and the dialog is set. Then the next line checks waits for text to occur on the page.I am pretty sure if you remove
assertWaitOnAjaxRequest()it would not cause the test to fail right now but it seems to be the luck of the draw.Comment #166
sam152 commentedReviewed this again, here is a patch which removes the try/catch in the transition forms and has a few other little cs fixes. Here is my 2c on why we shouldn't be adding the try/catch here:
It looks like work is already underway to fix this in #2886567: Adding a workflow state or transition with an integer ID results in unrecoverable fatal errors. Lets just follow-up there with the validation issues.
If we can agree on that, the rest of this looks great and I'm +1 to RTBC.
Comment #168
sam152 commentedComment #169
timmillwoodThanks @Sam152, I agree with the +1 to RTBC, so let's to this.
The try/catch was added to fix #81, it looks like this is no longer an issue.
I thought this approach was fine, it tidies up the method and is also consistent with elsewhere in the trait, but ok either way.
Here's some screenshots of the state, transition, and delete modals based on #166:

Comment #170
sam152 commentedThe command thing was purely style, happy with either, probably shouldn't have changed it.
Either way +1 RTBC and will follow-up with the try/catch in the other issue.
Comment #171
wim leersMostly nits, but 2 important questions: one thing that should be
@internaland a test that may need to be moved?This sounds/feels like it belongs in the
workflowsmodule, not thecontent_moderationmodule?Nit: no need for the intermediate
$bundlevariable.Also: is an actual custom block type, provided by
standard. I'm not a fan of creating test config with identical ids/labels, but that's not exactly the same. I think a random (or silly!) name is better. (Yes, this is partly why I've added so many llamas to core.)Ahh, the
editorialworkflow is default content provided by thecontent_moderationmodule, this is probably why.Should be marked
@internalAFAICT.Supernit: s/Close/Closes/
Using
Url::fromRoute(): 👍Nit: missing typehints?
Comment #172
sam152 commentedThe form
WorkflowTypeEditFormTestis testing used to be calledWorkflowTypeEditForm. Since #2896722, it's now calledContentModerationConfigureEntityTypesForm, so it should probably be renamed toContentModerationConfigureEntityTypesFormTest.@internal makes a lot of sense for the trait and the rest are all good nits.
Comment #173
wim leers#172: that rename would've addressed the questions/concerns in #171.1. Thanks!
Comment #174
manuel garcia commentedThanks all, working now on #171
Comment #175
manuel garcia commentedRe #171
1. Renamed to ContentModerationConfigureEntityTypesFormTest as suggested in #172.
2. I agree. Also, an Epic block is always better than a Basic block.
4. done
5. done
7. Fixed, also on
WorkflowStateAddForm,WorkflowTransitionEditFormandWorkflowStateEditForm.Comment #176
timmillwoodLooking epic, think we can go back to RTBC!
Comment #177
timmillwoodThis is a "should have" for Workflows to be stable, so will need to go in 8.4.x.
Comment #178
wim leers👏😀
Supernit: unnecessary blank line. Can be fixed on commit.
Comment #179
tim.plunkettI was reasonably sure this is invalid PHP, but I was wrong. Either way, having an optional parameter followed by a required parameter makes no sense.
This code has no handling for the case if $workflow is NULL. I'd just as soon drop the
= NULLthan add an if()... Also the $title variable is unneeded.Comment #180
wim leers#179: I agree. I saw this too, but forgot to comment on it.
Comment #181
wim leersFor #179/#180.
Comment #182
timmillwoodThanks @tim.plunkett and @Wim Leers.
Comment #183
wim leersRTBC++
Comment #184
sam152 commentedAs this primarily affects workflows, updating the component as mentioned in #2755073: WI: Content Moderation module roadmap.
Comment #185
sam152 commentedRerolled.
Comment #187
Bojhan commentedWhat about just saying "Transition label" and "State label" then you dont need the description.
Comment #188
sam152 commentedI botched the reroll.
Comment #189
sam152 commentedBack to RTBC. Re: #187, that makes a tonne of sense but is out of scope.
I've opened #2902247: Make #title of the "label" fields in the Workflow(Transition|State)(Add|Edit)Form clearer and remove the description. for this.
Comment #190
xjmI just saw that (a) this was not already committed (I thought it had been) and (b) that @timmillwood moved it back to 8.4.x. After the alpha freeze deadline we only decide after commit whether to backport things, and only until the beta freeze deadline. We don't grant any advance exceptions for things because there's no guarantee they will be committable in time for the release. Reference: https://www.drupal.org/core/d8-allowed-changes#alpha
Setting to 8.5.x so it's clear that this patch contains changes that are only allowed in a minor; otherwise it will be stuck in the patch queue. If another committer reviews this today and finds it ready I could see backporting it today early during the commit freeze.
Comment #191
Bojhan commented@Sam152 Thanks!
Comment #192
larowlanThis looks great, glad to see some big-time use of the dialogs API in core. Will provide a great example for people to reference.
And some awesome test coverage, really thorough.
A couple of observations that are largely nits, but one regression
nit: no need for the $user variable here
we can put
$this->assertSession()in a variable here, and save creating N instances.Suggest 'Provides a utility trait to simplify rendering forms in a dialog'
nit
!==The english here is slightly off.
we can return here and avoid the else. Makes it easier to understand
displays
I don't think there is any test coverage for these?
What is the reason for this change - feels like a regression/reroll issue?
Same again here, not sure we need the $user variable
Same story here, we're creating loads of objects we don't need. Let's just do
$assert = $this->assertSession()and reuse itand here too
<3
Comment #193
timmillwoodTrying to resolve all issues in #192.
Comment #195
timmillwoodFixing tests.
Comment #197
manuel garcia commentedThis should fix the failing tests =)
Comment #198
jofitzCoding standards corrections.
Comment #199
manuel garcia commentedI think we're ready to go back to RTBC =)
Comment #200
timmillwood+1 for RTBC.
Comment #201
xjmHm, this should probably be going in the module's CSS rather than Seven's? That or it's a separate issue that's straight visual bugfix.
Comment #202
timmillwood@xjm - this is a bug, but a very related one. It fixes the Ajax spinner from falling onto a new line in drop buttons. it doesn't seem worth creating a new issue for this.
Comment #203
xjmThanks @timmillwood. Please do create a new issue for that bugfix so that we can direct the frontend framework managers to a 5K CSS patch on an issue with three-or-so comments rather than a 200-comment feature addition that's a lot of Form API. :) (The frontend framework managers have limited availability but the CSS would stop me at least from committing this.) Also, bugfixes can potentially be backported during RC and maybe during a patch release, whereas this feature addition is 8.5.x only.
Edit: References on scoping:
https://www.drupal.org/core/scope#context
https://www.drupal.org/core/scope#release-schedule
Comment #204
tim.plunkettYou shouldn't need this "button" at all. I believe the style guide calls for cancel to be a link, as followed by ConfirmFormBase.
You could make a link, and if you give it the class
dialog-cancel, then dialog.ajax.js picks it up automatically. I figured this out when dealing with Layout Builder's dialogs.Comment #205
tim.plunkettWeird status crosspost...
Comment #206
manuel garcia commentedFair enough, created the separate issue to fix the bug with the throbbers, please have a look =):
#2909882: Throbbers showing within dropbuttons jump to next line
Here is the patch now without those changes.
Comment #207
timmillwoodHere's a patch implementing @tim.plunkett's suggestion in #204. It allows us to remove two classes from the DialogFormTrait too!
Comment #209
tim.plunkettThis is a link now
Comment #210
timmillwoodFixing the broken tests.
Comment #211
manuel garcia commentedBeautiful @timmillwood thanks!
OK, so #203 and #204 have been addressed... back to RTBC
Comment #212
vijaycs85+1 to RTBC. Patch at #210 still applies cleanly.
Comment #213
manuel garcia commented#2909882: Throbbers showing within dropbuttons jump to next line just got in.
Comment #215
manuel garcia commentedRerolling, 3 way merge did the trick.
Comment #216
timmillwoodBack to RTBC then!
Comment #217
xjmSo earlier on this issue, we talked about adding the trait to Workflows and not the Form API in order to have more flexibility to backport it without disruption. However, at this point, Workflows is already stable without this UI improvement, and it's just going to go into 8.5.x anyway. Part of my hesitation every time I open this issue in a tab is that I don't think we want to end up with three separate variants of a similar API for this, Settings Tray, and Layout Builder.
So at this point, I'm wondering if it makes sense to do #2896535: Create a helper trait for Forms in ajax dialogs first and build this as well as the Layout Builder's version on top of that, with a followup to refactor Settings Tray to use it also. I'd also prefer to have @tim.plunkett's explicit signoff (he's provided several reviews) since some version of this should end up in the Form API in one way or another.
Leaving at RTBC since this isn't a blocker (and I don't want to push the issue to change direction without confirming the approach with others first).
Comment #218
tim.plunkettIf there is still desire to do something generic, this would need work.
Additionally, I have some questions on why some parts of this are necessary.
This is similar to LB's code, except instead of drupal_modal we need to check for drupal_dialog.off_canvas.
No one has come up with a generic way to decide what to check for.
I'm not sure why this would need to be specified.
LB only needs to add the
dialog-cancelclass to confirmation forms, so this whole array isn't universally needed.Not reusable.
This shouldn't actually be needed? If you trigger the ModalRenderer, it should be handled for you.
The "if" half of this code is great, and generic. The "else" part is not.
This is how LB handles this:
Then each class using the trait can specify their particular part. Naming TBD.
Comment #219
timmillwood@tim.plunkett - the trait used to be much more generic, but it was not needed to be generic anymore, so we removed all of the generic parts. See #134 for example.
Comment #220
effulgentsia commentedFirst of all, I'm sorry this issue is taking so long. Once it lands, I think it'll be a nice UX improvement to Workflows.
Because Workflows is currently stable, prior to me committing the patch, I'd like to review it in more depth to think through whether anything about it feels too temporary and/or special-cased in a way that will make future maintenance on it more difficult due to needing to preserve BC. Some of the points in #218 might be relevant to that, others might not be.
Unfortunately, I won't be able to review it until about 2 weeks from now. I realize the timing of that isn't great, as then we start getting into holidays. If another committer wants to beat me to it, go for it.
Comment #221
larowlanTagging as there is potential for folks to work on this next week at the DS sprint
Comment #222
larowlanWe need a final sign off here from the UX team, the last review from @Bojhan in #56 was 'this is not close to RBTC' and then some minor comments after that, but no explicit sign-off.
I'll ping @yoroy for a review
Comment #223
hass commentedComment #225
webchickWe reviewed this on the UX team call today.
It seems like this issue has gone in a few different directions, with the advice above being to get the modals in first, then work on other improvements to the form separately (#2758623: [meta] Redesign workflow configuration page to better visually describe the flow). It was the overall form improvements that @Bojhan's previous comments in #56 was referring to, I believe.
So the end result of this issue seems to only be adding a new DialogFormTrait and utilizing it in the Workflows UI to put the add/edit/delete forms in a modal, similar to how the Views UI works. (Although the DialogFormTrait isn't applied to Views as part of this patch? Do we then risk introducing inconsistencies between the two?)
There were no objections from the UX team to utilizing this pattern; it makes sense, especially for short, simple forms like this. We should probably think about expanding it out to other places with short forms like Roles in follow-up patches.
However, as Gábor stated in #44, it's slightly risky to do this, only because we don't ultimately know where #2758623: [meta] Redesign workflow configuration page to better visually describe the flow will end up spec-wise, and we could end up "ping-ponging" users a bit, where 8.4 has forms on separate pages, 8.5 has them in modals, and 8.6 goes back to its own page again. :)
So we would love feedback from the Workflow team if https://www.drupal.org/files/issues/create-new-workflow.png is indeed the direction they want to go in. Because if so, it might not make sense to do this change here, and instead initially introduce the trait to a different set of forms, such as Roles.
Comment #226
manuel garcia commentedThanks a lot UX team for reviewing this!
About the UI conflict on editing transitions due to #2758623: [meta] Redesign workflow configuration page to better visually describe the flow:
When I saw that back in September I stopped working on this, as it became clear we were pushing in different directions. If that is indeed the direction this is going to be going, then I propose that we:
So to summarize, only the edit transition modals would cease to be necessary here. In my opinion adding a new transition would still be useful to do so in a modal instead of a new page, and the same goes for the confirmation form for deleting a transition.
Comment #227
timmillwoodI think we'll still need the trait even if we end up iterating on the form to fulfill the designs in the screenshot.
My vote would be to commit the current patch, as is, then use the three follow-up issues mentioned in #226 to iterate from there.
Comment #228
timmillwoodFixing items from #218 to bring things more into align with LB.
#218.1 - I Just copies the code from LB for now, we can merge when #2896535: Create a helper trait for Forms in ajax dialogs is in.
#218.2 - Removed
#218.3 - Some of these are Entity Forms, so could only fix on Conformation Forms.
#218.4 - I've removed this from the trait and added to the parent forms.
#218.5 - You are correct, removed.
#218.6 - Updated to be the same as LB.
Comment #230
timmillwoodFixing the failing test.
Turns out we do need
$form['#id'] = Html::getId($form_state->getBuildInfo()['form_id']);to show errors in the dialog.Also fixed a coding standards issue.
Comment #231
timmillwoodStill looking for reviews of this, it'd be a big UX win if we can move all workflow config to dialogs.
Comment #232
alexpott#2896535: Create a helper trait for Forms in ajax dialogs has landed - I think the patch can be updated to use it.
Comment #233
timmillwoodAwesome
Comment #234
jofitzRemoved DialogFormTrait and replaced usages with AjaxHelperTrait (from #2896535: Create a helper trait for Forms in ajax dialogs).
Comment #235
jofitzComment #236
timmillwoodThanks @Jo Fitzgerald!
Comment #238
timmillwoodSwitching from
AjaxHelperTraittoAjaxFormHelperTrait.Comment #239
vijaycs85Looks good.
Comment #241
manuel garcia commentedRerolled, just a small conflict on
core/modules/workflows/src/Form/WorkflowEditForm.php.Comment #242
timmillwoodBack to RTBC.
Comment #244
andrewmacpherson commentedTagging for the Manchester sprint today. @timmillwod mentioned on Slack that this might be an easy re-roll.
Comment #245
manuel garcia commentedReroll of #241, manually fixed conflicts on:
Comment #246
andrewmacpherson commentedPlease don't commit this without accessibility sign-off. There are a couple of must-fix accessibility issues here.
I have tried out the patch in #245, and noticed some unusual behaviour with the dialogs:
I'm still playing with this, trying to figure out what's wrong, and why focus isn't always moving to the dialog. I think 1 + 2 might be related to #2805219: Some dialogs do not receive focus when opened. I'm not sure if we need to do some extra step per-dialog (in the individual controller classes), or whether this is something that can be fixed for all dialogs generally (in the dialog or ajax JS libs).
--
Next, an accessibility problem with the delete dialogs. When using a keyboard there's a risk of accidental data loss. The problem arises when a keyboard user opens a delete dialog using the enter key. If a user accidentally presses enter twice, they can unintentionally delete config.
The delete dialogs don't have any form elements inside the dialog body, just the buttons in the dialog footer (delete + cancel). When the dialog opens, in the absence of any :tabbable controls in the dialog body, focus shifts to the delete button. I think that comes form the jQuery UI dialog behaviour.
We need to find a way to avoid focus landing on a dangerous delete button when a dialog opens.
Steps to reproduce:
This impacts users with motor impairments such as hand tremors. There's a general principle in accessibility, which is to avoid accidental data loss by providing an undo/revert feature, or use an additional confirmation step (i.e. these confirm-delete dialogs). The problem here though, is that there's a danger of accidental activation on the confirm-delete step. This situation isn't an issue when confirm-delete is on a separate page, because the user will have to tab several times to reach the button to confirm deletion. But in the dialogs, where we are focusing the confirm-delete button, an accidental double keypress will lead to data loss.
This can be mitigated by using the "slow keys" feature built into most operating systems, but I think this is a must-fix issue.
--
The problems also affect #2253257: Use a modal for entity delete operation links and #2254935: Use a modal for content entity form delete links confirmation forms. I'll mention it on those issues, too.
Comment #249
manuel garcia commentedRerolled #245 using three-way merge.
Comment #258
ayush.khare commentedReroll of #249 for 10.1.x
Comment #259
pooja saraah commentedFixed failed commands on #258
Attached patch against Drupal 10.1.x
keeping it in needs work for other failed commands need to be fixed.
Comment #261
amateescu commentedHere's a proper reroll of #249, because #258 was missing some changes to
WorkflowEditForm.Also fixed #241 1. and 2.
Note that the accessibility problem with the delete dialogs is also present on the entity delete operations (from #2253257: Use a modal for entity delete operation links), so I think it should be addressed more generally rather than in this specific patch.
Comment #262
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #263
amateescu commentedA few more fixes.
Comment #264
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #265
kostyashupenkoFixed issue reported by bot