This issue was originally spun off from #3023797-17: Let users choose what to do after selecting and/or adding items in the media library.
In that issue, we introduced two buttons to the Media Library screen that appears when you have added new media and need to enter required metadata. The two buttons say and do slightly different things:
- Save and select: saves the media item(s) and redirects you back to the main media library, with your new items at the top of the list and added to your selection, along with all the things you had selected before you added the new items.
- Save and insert: saves the media item(s), closes the modal dialog, and adds the new items, plus anything you had already selected from the media library, to the field that opened the media library.
The original feedback was:
The terminology of the buttons could be improved, but this could be done in a follow up.
This issue was originally meant as a bikeshed over the buttons' wording and designs, until Wim Leers waltzed in and threw a spanner in the works in #8. He proposed that we outright remove the two buttons, and replace it with a single Save button that takes you back to the media library every time.
After discussion with the UX and accessibility teams, we reached a compromise: do exactly what Wim proposed by default, but add a global configuration switch to keep the old "two buttons" workflow, for power users who may find it useful.
Without "Advanced UI" mode enabled:
With "Advanced UI" mode enabled (same as before this change):
Release notes snippet
In Drupal 8.7, the Media Library provided two save buttons to users: "Save and select" (which returns the user to the Media Library to select more items, for bulk uploads) and "Save and insert" (which would close the library immediately insert the selected items in the field or text editor). This proved confusing to users. In 8.8, by default there is now simply a "Save" button that returns the user to the library. The previous workflow is still available as an optional advanced configuration and can be enabled in a new settings page under Configuration > Media > Media Library settings.
Comment | File | Size | Author |
---|---|---|---|
#58 | media-advanced.png | 237.84 KB | webchick |
#58 | media-settings-form.png | 82.34 KB | webchick |
#58 | media-admin-menu.png | 101.75 KB | webchick |
#58 | media-only-save.png | 223.03 KB | webchick |
#56 | interdiff-3034242-54-56.txt | 1.91 KB | phenaproxima |
Comments
Comment #3
xjmComment #4
Wim LeersHow about:
Comment #5
bnjmnmSince these buttons are always together (?), we can also explore options where the of one button contexualizes the other. Choices that may not work for a single button but work well when paired. For example, the "Save and continue" suggestion in #4 appeals to me, I think that anything confusing about that wording can be mitigated by the wording of its companion button.
Anyway, I provided a list of several different places to store a bike. I have no presumptions about any of them being the ideal choice, this just seems like a problem that benefits from a little brainstorming.
I'm also wondering if the buttons should receive the same styling as one currently has primary styling and the other secondary, but that doesn't represent the actual relationship of the buttons.
Comment #6
phenaproximaPersonally I was thinking that "Save and select" should become "Save and choose more", and "Save and insert" should be "Save and finish".
Comment #7
Wim Leers🤩😆
I realized it might help to know what buttons we're actually talking about. We're talking about the ones when uploading (adding) media:
Comment #8
Wim LeersAnalysis
I tried to take a bigger picture perspective. I stepped through this in the UI.
I now think the problem isn't these button labels, but that we want the user to be able to "skip a step" and in doing so we complicate things.
Note that both actually select the media we just added. Which makes sense. Why would I be adding media that I don't intend to use?
Proposal
Imagine if we removed that ability to insert. Meaning, that once you're adding media, you're only adding media. You need to get back to the Media Library selection UI before you can insert. That'd mean one extra button click but zero confusion.
Because then we'd have only one button: "Save". For sighted users, it's going to be obvious the newly created media is selected. For visually impaired users, we could add a
Drupal.announce()
call.The irony is that #3023797: Let users choose what to do after selecting and/or adding items in the media library (which triggered this issue) is where those buttons were added. But I think that thanks to improvements in other aspects of the Media Library, we should reconsider whether that solution was the right one.
That'd then look like this:
Consequence of the proposal
The whole "selection area" thing in a
<details>
element would then also go away. It's super confusing anyway.I never noticed it even existed until today, until me trying to make sense of things. The selection area (a "collapsed details" element) only appears if you already have a selection and are adding more media. It looks super weird and confusing that the selection is still visually present in this weird way when adding more media. I wonder if this was done for accessibility reasons?
Comment #9
Wim LeersA walkthrough of the patch in #8:
This is the selection area being removed.
This is the rename.
This button is now gone. Hence its callback can be removed too.
This is the announcement for accessibility reasons, which informs a visually impaired user that triggering the "Save" button not only saved the newly created media, but also added it to the current selection.
All test coverage changes are to accommodate for:
Comment #10
seanBWe have had reports that’s it was not entirely clear what happened to previously uploaded files, so we tried to preserve those for UX and A11Y purposes in the second step of the add form. The extra save and insert button was added for users that want to skip a step and use the media library a lot.
I do see there is value in hiding options for users by default. We could make the extra button and selection overview optional by adding a checkbox to turn it on/off in the widget / WYSIWYG config? I would say the extra 'Save and insert' button should be disabled by default, and the selection area should be enabled by default.
On the other hand, since this is all a form, we could easily let this be handled by contrib as well. Not sure how many options core should support for this.
Comment #11
webchickOoof. Okaaayyy. @Wim Leers walked me through his patch and rationale a bit earlier today.
First, some backstory:
The reason that second button initially came about was two-fold:
1) There were a variety of interaction problems with Media Library at the time, which are documented in the original issue summary, and I think all of which are fixed now... yay!
2) With a mind toward the fact that the "80% case" for Media is to add new things, we wanted to add a "shortcut" mechanism that did not involve an extra frustrating click every time you did that. (This also brings parity with Image fields which let you just add the image and then you're done.) This is still relevant today.
However.
Having been away from these interactions for awhile, viewing it through a "new" user's (Wim's) eyes was pretty enlightening. There is definitely a cognitive load issue, for new and/or infrequent users. And I remember in UX reviews going back and forth on how to show the previously-selected things, how to do it in a way that was accessible but not drawing too much attention to it, etc. It was definitely not intuitive, and there were several rounds of backflips getting it to the current state of (relative) sense-making.
Versus the new patch is pretty dead-simple. "Save." That's it. And you're always taken back to the same place, which you grow to expect. The main downside is it's a bit annoying that you have to click two times once you know what you're doing.
When we get into these "should we do A which benefits these kinds of users or B which benefits these kinds of users" conundrums, my preferred approach is to look at what other CMSes do, and WordPress is an easy go-to one because it makes up 25%+ of the internet. :P So when we're talking user expectations, that tends to be it.
They also use a "save, then insert" UX pattern. So we are conforming to broader user expectations as well if we go the route of Wim's patch.
---
SO. :P
+1 to Wim's patch in #8. @seanB also suggested making this behaviour configurable since he (and I, and a lot of other "power users") actually use the "Save and insert" button quite a lot. I think that could also be a good idea, but we maybe want to handle that separately, because what we've got here is a straight-forward fix, that bascially only removes code, and that brings our Media Library up to what most users will expect.
Terribly sorry for the 6+ month rigamarole. :P Ugh.
Comment #12
seanBIf we want to make it configurable, removing the code and adding it back seems like more complex changes than directly adding a checkbox and changing the buttons conditionally.
Besides that, I have no problem with a change in the default behavior. Not having the extra 'Save and insert' is fine as long as I can easily enable it again if needed.
We might also want to check the a11y implications of removing the selection overview, but I see we already have a tag for that.
Comment #13
phenaproxima+1 to simplifying it, and +1 to making it configurable. Personally, however, I think the setting to show the extra button and/or the selection overview should be sitewide config, rather than per-instance. It's one thing to tweak "things you're allowed to see" (i.e, media types etc.), but another to vary the entire workflow of the actual UI per instance. To keep things semi-consistent, IMHO these options should be exposed in config. I think it would also be quite a bit simpler to implement.
Comment #14
shaalI agree with +1 to simplifying it, and +1 to making it configurable.
I just read this research, so important to strive for a simple(r) UI.
The Distribution of Users’ Computer Skills: Worse Than You Think
Across 33 rich countries, only 5% of the population has high computer-related abilities, and only a third of people can complete medium-complexity tasks.
Comment #15
oknateI love the new simpler button. Even I, who have used Media Library for a while, have had to think about which button to press. Now there's only one, so there's zero stopping to consider options. So +1 to dropping the "Select and insert". The dropped button saves time, but it also means you have to read and think about the two buttons nearly every time to make sure you are pressing the right button.
I do think this is complicated by this issue: #3059955: It is possible to overflow the number of items allowed in Media Library
Video:
https://www.drupal.org/files/issues/2019-10-06/surprising-selection-due-...
This actually happened to me when testing. I would expect, if cardinality is one, my latest selection would be the one inserted.
Comment #16
Wim LeersYep, it allows you to save time in principle, but the user having to make a decision every single time probably means that for a large number of users, it actually is not faster. I know it isn't faster for me at least :)
That's a long pre-existing issue and does not block this change. That problem exists both before and after this patch.
It sounds like we have unanimous agreement:
The only remaining decision is to A) make this configurable here, B) if so, where to put that configuration, C) how to explain that to end users.
I am personally not convinced this is worth making configurable. I personally think this is better always.
So: what is the rationale to keep this around and make this configurable?
Comment #17
Wim LeersBased on the confirmation of current confusion, bumping to
.Comment #18
seanBMakes sense, +1 for sitewide config.
I don't have any hard statistics on usage of the buttons, but I work with a lot of trained editors that like these kind of shortcuts. I know people are using it. Specially for media rich sites where users have to upload multiple media items on a daily basis. I think that is exactly why webchick asked us to build this in the first place.
The fact that we went through multiple demo's for the UX team confirms that it is not a crazy complex button, even though we might want to hide it by default.
Not really sure about the BC rules for these kinds of things, but we might want to think about that too..
Comment #19
phenaproximaIf we make it a sitewide config option, the BC implications are virtually nil: ship with the button turned off, but add an update hook that turns it on by default, thus preserving existing behavior. Not at all unheard of, and quite simple for us to implement! :)
Comment #20
Wim LeersWith regards to BC (Backwards Compatibility): this module is experimental. This does not cause data loss. There is therefore zero BC impact.
Comment #21
dwwFWIW (not much), some random thoughts:
#include "bikeshed.h"
. ;)Comment #22
Wim LeersThanks for #21.3 + #21.4 (which implies we need to also bikeshed where to put this setting, how to label it, how to document it, how to explain this super abstract thing at all) + #21.5.
Those are exactly the reasons that cause me to propose to simply remove it. So much complexity. So little gain. For the small number of sites that want this, it's much easier to install a contrib module because that contrib module can more clearly explain it than some obscure setting can.
Comment #23
phenaproximaThis sounds like a product manager decision to me.
Comment #24
phenaproxima@webchick will update this issue later with the details, but here's a first pass at a patch to make this configurable.
Comment #25
phenaproximaAnd here it is with a settings form.
Comment #26
phenaproximaAnd now with an update path.
Comment #27
webchickOk, so that I was not deciding this in a vacuum, also discussed this on today's UX meeting with @Gábor Hojtsy, @ckrina, @andrewmacpherson, @worldlinemine, @phenaproxima, and @seanb. (I'll link to the video once I have it.)
We demoed the current state of things, as well as the state after the patch, and presented the rationale for simplifying the interface (even brought up the dreaded W word ;)).
Despite this justification, there was still broad consensus among those on the UX team that this "higher cognitive load" workflow is necessary from a "power user" POV. Multiple users over multiple UX calls raised this concern. (Though granted, people attending Drupal UX meetings tend to be a bit more "power" of a user than most. ;)) There was also some back and forth about the "Additional selected media" stuff, but that once again came directly from user feedback.
The consensus among those in attendance was basically the same as the latest comments here: that making it configurable, as a global setting, but with the default configuration being to show the "simple" setting w/ just a single button, is something everyone agreed to. This way, we don't lose a valuable feature / functionality until/unless "someone" creates an improved design that helps address the cognitive load issue.
And, if it's a global setting, then regardless of the setting, it's one consistent experience for all users on the site. (Versus using something like permissions or what have you.)
Additionally, it would be really nice if we actually had an issue to discuss the naming of those labels. ;) I'm not sure if it makes more sense to spin off a separate issue for "Make this configurable to address cognitive load" or repurpose this issue for that reason, and spin off a "Bikeshed the labels some more" issue, but. :)
Comment #31
phenaproximaRe-titling for clarity on the new direction of this issue. And tagging for a follow-up to actually discuss the wording of the buttons.
Comment #32
phenaproximaTo be clear, I think what the test coverage needs to do is basically this: ideally, we would test every interaction with the media library widget we currently do, except that we would test them with both workflows -- the simplified way, and the new "power user" way.
I realize that might be really complex, and if that turns out to be the case, then we can back off and just add some basic coverage of selecting and adding things in the media library widget using the power user workflow, as its own new test method in MediaLibraryTest.
Comment #33
oknateAssigning to myself to work on test coverage.
Comment #34
oknateHere's test coverage that builds on top of the test improvements in #3055648-47: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest.
I was going back and forth on whether to use that patch, but at least for now, I think this is the right thing to do. I'll see if I can come up with a patch that doesn't use those improvements.
So postponing on that issue, for now. If I can create a patch with similar changes without that patch, I'll unpostpone it. Ideally, that one could go in quickly, and this patch would only need a reroll.
Comment #35
oknateUnassigning
Comment #36
phenaproxima#3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest is in, unblocking test coverage for this. Off we go!
Comment #37
phenaproximaI think we should opt for pretty basic test coverage here. So here's what we should do:
1) Update path test. That should be really easy.
2) A test of the "advanced mode", in MediaLibraryTest, as a new method:
Comment #38
oknateReroll of #34, sorry, cross posting.
I added a data provider and it runs through the file upload test and the oembed add form test with advanced mode and basic mode.
The one thing it’s missing is assertions that the other buttons don’t appear, but I don’t think it’s really necessary.
If you find the button “Save”, you know “Save and select” isn’t present.
Comment #39
phenaproximaAdded an update path test.
Comment #40
phenaproximaI appreciate the data pattern implementation in #38; it does what I asked, and I think it's about as clean as it could be.
But, to be very honest, I'm rather worried that it makes an already very complicated test more convoluted than it ideally should be. That especially rattles my nerves because we are so close to the 8.8.0-alpha1 deadline.
That said, since this is a "power user" UI, maybe the basic coverage I suggested in #37 would be sufficient?
Comment #41
webchickI agree with the test plan in #37 FWIW.
Comment #43
larowlandoesn't this also need a call to ->save()?
and in which case, missing tests?
crediting jibran who I consulted on the update vs post-update for the new config (thanks jibran, you're my update-path spirit animal)
Comment #44
larowlanfor #43
Comment #45
phenaproximaGood call on the missing test coverage, @larowlan. I have added some, and fixed bugs it uncovered.
Speaking of test coverage...I think what might be easiest for us to land this, is to go for the sledgehammer approach. I copied all of MediaLibraryTest's testWidgetUpload() and testWidgetOEmbed() methods into new test methods which use the "advanced" UI. That way we get to keep all existing coverage, but also test that both workflows work correctly.
The downside is that it massively increases the size of MediaLibraryTest. But, that test is already an extremely complicated mess, and we're planning to heavily refactor it anyway over in #3087227: [META] Split up and refactor MediaLibraryTest. (Ideally we'll split it up into several smaller tests, sharing functionality with a trait.) Meanwhile, this feature needs to land before alpha, but test refactoring can happen anytime.
So in the name of pragmatism, I suggest we just accept the temporarily bloated test coverage in the name of getting this done. Let's see if this passes testbot.
I'm not bothering with an interdiff this time, because it'd be a 49 KB interdiff against a 46 KB patch.
Comment #46
phenaproximaComment #49
larowlanFWIW I was only talking about tests for the admin form
Comment #50
oknateHere's a fix for the failure in #45. I'll add test coverage for the admin form.
Comment #51
oknateHere's test coverage for the admin settings form that @larowlan asked for in #43.
The interdiff is off. See the next comment for the corrected interdiff.
Comment #52
oknateCorrected interdiff.
Comment #53
phenaproximaI'm so sorry for the miscommunication -- it was midnight -- but #45 does include test coverage for the admin form. It's non-JavaScript test coverage and it is in its own class, so I'd rather we use that instead of adding even more stuff to MediaLibraryTest. @oknate, can you merge your fixes with the non-JS test I added in #45?
Comment #54
oknateRemoving the duplicate test coverage for the settings form.
Comment #55
seanBI still need to read the whole test by applying the test, the diff makes it hard to see the result. But here is some first feedback.
Does that @after belong here?
This test looks a bit funny on its own. Can't we do this as part of the advanced UI test?
It looks like we have a double line break here?
Comment #56
phenaproximaAddressed feedback and added @todos to merge the tests during refactoring in #3087227: [META] Split up and refactor MediaLibraryTest.
Comment #57
seanBI can live with #55.2 being a part of #3087227: [META] Split up and refactor MediaLibraryTest. The tests slowly got out of hand with every added feature and good thing we are now taking a step back to improve it.
Ad far as the feature itself, it is a nice and relatively simple change, which I personally think will definitely make a difference for power users. So happy we made it configurable, but at the same time happy we simplified for people first installing Drupal. So overall +1 to adding this asap.
Also removing the `needs accessibility review` since andrewmacpherson was there during the last UX demo and didn't see any objections from an a11y standpoint.
We have the setting, the upgrade path, and pretty extensive tests (and a followup to improve the overall tests). It looks ready to me. RTBC. Thanks!
Comment #58
webchickAwesome stuff. I think this is a really great usability enhancement without screwing advanced users.
As intended, here's how the default behaviour now looks:
(Side note: I LOLed because my mouse IMMEDIATELY jumped to where the "Save and insert" button... wasn't. :D Muscle memory is a powerful thing. ;))
The new setting is under the "Media" grouping:
The form looks like this:
(Side-note: that description text is kinda novella-ish, but OTOH there's a lot it needs to cover, so I think that is fine.)
Now, you get the original UI when using the media library:
So all good from a UX-POV!
---
Code review-wise, everything is fine and good and really straight-forward until you get to the tests which... YOWZA! :O
I talked to @phenaproxima and @oknate about that, and they explained that because Media Library is now bifurcated along two flows, they didn't want to inadvertently introduce bugs due to lack of test coverage on the "advanced" path, so opted to WAY OVERKILL the test coverage for now, but to clean it up in #3087227: [META] Split up and refactor MediaLibraryTest, which is not bound by alpha deadline, and is a good idea to do at the end anyway because once all the "feature-y" bits are done, the tests can be refactored with the whole picture in mind. Makes sense.
So. Without further ado...!
...I have a phone call now, and don't have bandwidth to figure out issue credit. :P But once that's done, this sucker is IN! Great work everyone!!
Comment #59
phenaproximaAdjusting credit.
Comment #60
phenaproximaComment #61
phenaproximaComment #66
phenaproximaWhat the hell? The credit system threw my crediting out. Let's try that again.
Comment #69
webchickAWESOME! Committed and pushed to 8.8.x (and 8.9.x and 9.0.x :P).
YAYYYY!
Comment #71
webchickAlso I think to simplified UI is worth calling out as a highlight, and the fact that this is now triggered by a setting is worth calling out in the release notes. Tagging accordingly.
Comment #72
oknateUpdating the issue summary, which only had a before screenshot, to have screenshot of the new default UI.
Comment #73
Wim Leers🥳 I'm now looking forward to using Media on my Drupal site even more!
Comment #74
webchickHooray! :)
And one more credit adjustment!
Comment #75
xjmReworking the release note a little for clarity.