Problem/Motivation

While adding tabs to the media library modal in #3020716: Add vertical tabs style menu to media library, there was a need to make the selection persistent across the different tabs of the modal. When selecting items in several tabs, filtering and pagina at the same time, it could be hard to remember which exact items are already selected and/or where a specific item was selected.

Proposed resolution

We already show a count of the selected items, it would be nice to add a button to the selection count that shows an overview of all selected items inside the modal.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3023809

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

seanB created an issue. See original summary.

psingh10’s picture

This feature is part of Entity Browser module, if you use entity browser along with core media module then you will be able to see what all items are selected to be uploaded.

andrewmacpherson’s picture

Issue tags: +accessibility

it would be nice to add a link to the selection count that shows an overview of all selected items.

Linking to where, exactly? The selection process is all going on inside a dialog so the overview should be in the same dialog. Does this actually mean a hyperlink, or some other "clickable" thing (a button) which reveals it ?

Some guidelines for making this accessible.

  1. The summary would be better if it was visible, and didn't require any clicking at all to reveal it.
  2. If clicking is used, it would be better if it revealed something adjacent to a disclosure button. A details/summary group would be ideal for that.
  3. If clicking is used, it will be overcomplicating things if the summary is displayed somewhere else, further away in the DOM. That would mean special measures are needed to inform assistive tech users that newly-revealed information has appeared elsewhere on the screen.
  4. And it would also overcomplicate things if clicking involved moving the focus to another element elsewhere in the DOM, because that's a context shift which may be disorientating, and/or make it awkward to recover your place in the task steps.

An alternative (or additional) way to indicate this would be with a message on each tab, to say how many are selected inside that group. Similar to the ones that Form API vertical tabs provides.

andrewmacpherson’s picture

Issue tags: -accessibility +Accessibility
Related issues: +#3020716: Add vertical tabs style menu to media library
seanb’s picture

Issue summary: View changes

Linking to where, exactly? The selection process is all going on inside a dialog so the overview should be in the same dialog. Does this actually mean a hyperlink, or some other "clickable" thing (a button) which reveals it ?

A button to reveal the selected items in the modal. Updated that in the IS.

  1. The summary would be better if it was visible, and didn't require any clicking at all to reveal it.
  2. If clicking is used, it would be better if it revealed something adjacent to a disclosure button. A details/summary group would be ideal for that.
  3. If clicking is used, it will be overcomplicating things if the summary is displayed somewhere else, further away in the DOM. That would mean special measures are needed to inform assistive tech users that newly-revealed information has appeared elsewhere on the screen.
  4. And it would also overcomplicate things if clicking involved moving the focus to another element elsewhere in the DOM, because that's a context shift which may be disorientating, and/or make it awkward to recover your place in the task steps.

1. I totally agree, not sure how that would visually look though. We have very limited space to work with.
2. The button would be in the button pane of the dialog, not really sure how we could fit the whole summary in there. Is it possible to move the focus after clicking the button? If that is an issue, maybe the button pane is not the best location for the button and we should see if that need to be in a different location?
3. My first thought was to make it similar to how the vertical tab links work. We replace the modal content and move the focus. Does that work?
4. Ah, that answer my question for the previous point. I can't think of an alternative solution with the limited space in the modal. Does it help if we have a button 'Back to selection' which shifts the focus back to the state the user came from?

An alternative (or additional) way to indicate this would be with a message on each tab, to say how many are selected inside that group. Similar to the ones that Form API vertical tabs provides.

We thought about this, but we can't guarantee the items are actually visible on the tab. Specially if there are hundreds of media items in the library. For example, if you selected something in page 2 and 5 of that tab, the tab would show '2 items selected', but when you click that you don't see anything selected. This gets worse when you use the filters of the view. This is at least a UX problem, not sure if it is an accessibility problem as well. I guess that is a bit different from regular vertical tabs.

andrewmacpherson’s picture

Issue summary: View changes

I think these proposals to programatically shift focus around inside a dialog are a very risky idea.

My list in #3 was ordered from feasible to not-feasible. To be clear, I am against #3.4 entirely. (I should be more careful what I suggest.)

The dialog is basically a small window attached to the trigger button ("add media") in the underlying page. We programatically move focus to the dialog, and constrain focus to the dialog until the task is finished (or aborted). That's a straightforward change of context which has lots of affordances to help orientate yourself. Notably, dialogs have a name, and are announced as dialogs (role), and focus moves to the start of the dialog. Those are equivalent to what you get from a normal page load in the browser, or the windows and dialogs of any other desktop application.

It's one thing to programatically move focus to a dialog, which has well-known structure, semantics, and behaviour like these. But it's quite another thing to move focus around inside a dialog. It's rare to find shifts like that inside native application dialogs (I can't think of any) and we see that sort of thing on a nornal web page either.

#5.2

2. The button would be in the button pane of the dialog, not really sure how we could fit the whole summary in there

Hang on, is there a design for this already?

#5.3

3. My first thought was to make it similar to how the vertical tab links work. We replace the modal content and move the focus. Does that work?

I'm not sure I understand this. Does this mean the vertical tabs have gone when you see the summary?

#5.4

Does it help if we have a button 'Back to selection' which shifts the focus back to the state the user came from?

No, I doubt it. This is just adding more complexity (yet another button) to try to get around a bad situation. First you have an unexpected change of context, via a programnatic focus shift. which means users have to reorientate themselves after that. Then you're expecting them to discover (i.e. look for) another control to shift focus back again. This is unusual behaviour; I can't think of an example of where that happens in a native desktop application dialog.

we can't guarantee the items are actually visible on the tab. Specially if there are hundreds of media items in the library. For example, if you selected something in page 2 and 5 of that tab, the tab would show '2 items selected', but when you click that you don't see anything selected.

To me the important information is: "Which media types do I have selections from?" So that if I need to unselect some, because I've reached the limit, then at least I have some idea which tabs to look in. I don't think the pagination matters, or even the exact counts for each type. It's more a case of "I have 5 selections, comprising some images and remote videos. So I don't need to look inside the audio tab". That's what I meant in #18.4 in #3020716-18: Add vertical tabs style menu to media library.

Something that's missing so far is: what information do you want to show to the user?
So far "shows an overview of all selected items inside the modal" is a bit vague. Is this mentioned in a comnent in the previous issue?

andrewmacpherson’s picture

@prerna_01 - do you have a screenshot of what you mean in #2?

andrewmacpherson’s picture

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rainbreaw’s picture

I might not have enough history on this particular topic and may be repeating something already considered... but looking over the conversation between @andrewmacpherson and @seanB and thinking about the UI that is currently set up, I'm curious if the idea of adding an additional tab for this has been explored?

I'm thinking of something similar to the #3023806: Add "All" tab with all media items to the media library widget concept. In this case, it would be "Currently selected" as the last tab.

xjm’s picture

Category: Feature request » Task
Priority: Normal » Major

Bumping to major task as this was listed as a should-have on #2834729: [META] Roadmap to stabilize Media Library. Thanks!

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

casey’s picture

Status: Active » Needs review
StatusFileSize
new15.93 KB

I've worked on this issue today during the code sprint at Drupalcon Amsterdam. After some introduction from @seanB on this issue I've created a initial poc.

Like @rainbreaw suggested the patch adds a "Selection" tab which displays a view display containing all selected items.

Status: Needs review » Needs work

The last submitted patch, 14: 3023809-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

bnjmnm’s picture

Status: Needs work » Needs review
StatusFileSize
new3.5 KB
new18.49 KB

Fixed test failures

seanb’s picture

Just reviewed #16. Also added a grid/table display for the current selection since I think that is important, and an update hook to add the displays for existing sites.

Also some screenshots and a video of how it currently looks (media-library-current-selection.mp4). I personally think having a tab for the current selection is a bit confusing. It kind of looks like a media type. Maybe it would be better to move the link to the "X of N items selected" text in the bottom right corner.

New tab in the modal
Media library current selection tab.

Grid view for current selection
Media library current selection tab (grid display).

Table view for current selection
Media library current selection tab (table display).

We still need to write tests for it. Might be good to start with that after #3087227: [META] Split up and refactor MediaLibraryTest. We should probably demo the current progress to the UX team to discuss it.

seanb’s picture

StatusFileSize
new1.05 MB

Here is a new design of what my suggestion in #17 could look like.

  • When you click the link in the bottom right, we replace the entire modal with a selection overview. We also hide the media type tabs to avoid confusion with the type selection tabs.
  • We don’t have any filters, since this might be a bit overkill, but at the top we show a link to return to the media library.
  • We also add a grid/table link to allow users to see their selection in their preferred way.

Feedback is very welcome :)

Design proposal for current selection overview.

Status: Needs review » Needs work

The last submitted patch, 17: 3023809-17.patch, failed testing. View results

vulcanr’s picture

I'm not quite understanding #17.

So, when does this happen? Going in a workflow way should be something like:

1 - Open media library
2 - Select the Items
3 - Click on `Insert Selected` button

In between of this 3 steps would come that screen proposed on #17? is it on:

1 - Open media library
2 - Select the items
3 - Click on `Selected 3 of n` link/button (so there we switch the content of the modal from all media items to only selected items)
4 - Click on `Insert Selected` button?

seanb’s picture

The selection overview is not necessarily part of the workflow. For #17 it will be:

  1. Open the media library
  2. Select some items
  3. Optionally view your current selection via the 'Selection' tab
  4. Click on the insert selection button

For #18 it will be:

  1. Open the media library
  2. Select some items
  3. Optionally view your current selection via the 'X of N items selected' link
  4. Click on the insert selection button

The main differences are:

  • For #18 we don't show the vertical tabs but we show a 'Return to media library' link instead.
  • For #18 the filters on the selection overview are currently hidden, but we could do the same for #17.

The video in #17 might also help, see media-library-current-selection.mp4.

vulcanr’s picture

Ok I get it now, I personally might like better the approach of #17. Might be good (just a thought) adding to the side of the `Selection` String on the tab, the number of items selected, for example: `Selection (3)`. Just an idea, to keep brainstorming.

ckrina’s picture

I think there are 2 things to discuss:

  • The option to have always visible the rest of the navigation inside the modal.
  • The design solution of using another tab in the same level to fit the current selection.

I don't think adding the current selection at the same level as the rest of the "types of media" navigation is a good solution. They have separate purpose and grouping them together with the exact look&feel is confusing as @seanB says.

I'd compare this workflow with an commerce&cart journey: I totally see the value on reviewing what has been selected but we should visually communicate it's a different path and the user should be able to skip it.

So I really like @seanB's proposal about using the "summary" of what you're doing as a link to the "cart". But I miss the "active state" or a visual clue to know that "I'm reviewing what I've selected". Maybe a title and that it's not a link anymore is a first step, but I'd say it needs more clues.

About removing the tabs on this screen, it removes visual noise&confusion so I'd +1 to that as long as the "Return to the Media library" or "Select more" or something similar says clearly tat you can go back.

xjm’s picture

Issue tags: -needs UX review +Needs usability review

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new34.35 KB

Reroll patch created for 9.1.x.

Status: Needs review » Needs work

The last submitted patch, 26: 3023809_26.patch, failed testing. View results

phenaproxima’s picture

Category: Task » Feature request
Issue tags: +Triaged Media Initiative issue

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nishantghetiya made their first commit to this issue’s fork.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.