Problem/Motivation

Spin-off from #2988431: [Meta] Accessibility plan for Media Library Widget:

The grid view contains a link you can't click.

Currently, when using the media library widget, the grid display of the media item contains a link to the canonical URL of the media item. This is the case for:

This currently has 2 issues:

  1. Media does not necessarily have a canonical route, see #3017935: Media items should not be available at /media/{id} to users with 'view media' permission by default
  2. For at least the links in the modal, we don't want them to be active because they take the user away from their current task, without being able to go back. This has been "solved" by adding pointer-events:none on and a click handler, but users can still tab to the link.

Proposed resolution

I don't think we really need this link. Let's just remove it.

Turns out we used the link for the admin/content/media overview to link to the edit page. Since the media view modes are shared between the admin/content/medias overview and the media library widget, some hacks are in place to prevent users from navigating away from the widget.

The proposed resolution is:
- Remove the link from the view mode.
- Add a new edit link to the page display of the media library view (used for admin/content/media) so users can still edit media.
- Add a new delete link to the page display as well. This could be done in a separate issue, but doing it here might make it easier to review and minimizes the number of update hooks touching the existing views of users.

Remaining tasks

  • Write patch
  • Write update hook test
  • Code review
  • A11Y review
  • UX Review
  • Frontend review
  • Commit

User interface changes

Remove the link from the grid display of media items in the media library widget.

Current HTML
Current tabbability
As you can see, we can still tab to it, despite pointer-events: none;:

UI before
Media library with edit link in name.
Updated UI
Media library with edit and delete buttons.

API changes

None

Data model changes

None

Release notes snippet

CommentFileSizeAuthor
#62 3039829-62.patch65.48 KBalexpott
#62 61-62-interdiff.txt2.19 KBalexpott
#61 3039829-61.patch65.67 KBalexpott
#61 56-61-interdiff.txt1.06 KBalexpott
#58 3039829-58.png175.54 KBphenaproxima
#56 firefox-chrome-delete-button-change.png550.43 KBstarshaped
#56 interdiff-3039829-44-56.txt445 bytesstarshaped
#56 3039829-56.patch66.11 KBstarshaped
#54 3039829-54.png194.83 KBphenaproxima
#53 3039829-53.png195.51 KBphenaproxima
#52 chrome-firefox-delete.png1.74 MBstarshaped
#51 delete_ff.png9.29 KBlauriii
#51 delete_chrome.png9.63 KBlauriii
#46 3039829-44-reroll.patch65.5 KBseanb
#44 3039829-44.patch65.47 KBseanb
#44 interdiff-39-44.txt52.12 KBseanb
#39 3039829-39.patch51.11 KBseanb
#39 interdiff-32-39.txt33.45 KBseanb
#35 media-library-edit-delete-buttons.png1.48 MBseanb
#35 media-library-before.png1.52 MBseanb
#34 3039829-32.patch26.04 KBseanb
#34 interdiff-31-32.txt21.89 KBseanb
#31 interdiff_24-31.txt2.9 KBgease
#31 drupal-media-remove-link-3039829-31.patch16.5 KBgease
#25 Media library after.png35.27 KBgease
#25 Media library before.png34.32 KBgease
#24 interdiff_23-24.txt2.72 KBgease
#24 drupal-media-remove-link-3039829-24.patch16.4 KBgease
#23 interdiff_21-23.txt1.31 KBgease
#23 drupal-media-remove-link-3039829-23.patch14.54 KBgease
#21 interdiff_13-21.txt4.99 KBgease
#21 drupal-media-remove-link-3039829-21.patch13.54 KBgease
#14 all-the-things.png177.93 KBseanb
#14 edit-only.png177.02 KBseanb
#14 before.png176.15 KBseanb
#13 interdiff_9-13.txt1.62 KBgease
#13 drupal-media-remove-link-3039829-13.patch9.73 KBgease
#9 drupal-media-remove-link-3039829-9.patch7.94 KBgease
#3 Screenshot 2019-05-28 at 11.27.29.png115.06 KBwim leers
#3 Screenshot 2019-05-28 at 11.28.40.png1.08 MBwim leers

Comments

seanB created an issue. See original summary.

mgifford’s picture

Can you include a screenshot of the problem? Maybe even of the desired state too?

wim leers’s picture

Issue summary: View changes
StatusFileSize
new1.08 MB
new115.06 KB

This has tripped me up many times.

#2: Screenshots added. The desired state is simple: remove the <a>, but keep the text wrapped by the <a>.

seanb’s picture

#2: Screenshots added. The desired state is simple: remove the , but keep the text wrapped by the .

Correct! The view mode is also being used on the media overview on admin/content/media though. We still need to agree on the best way to solve this, or at least need UX approval on whether it is ok to just remove the link.

phenaproxima’s picture

I think Wim pretty much nailed it.

wim leers’s picture

Oh, I hadn’t considered #4! That is a very good point. I think in that case the entire thumbnail could be made into a link?

andrewmacpherson’s picture

As well as the CSS pointer-events: none, there is a JS keypress listener which tries to "fix" this for by presenting a confirmation dialog. Can we clean that up at the same time?

There's another side to this which is that we expand the size of the link when it has focus, to avoid truncating the media label. I don't recall how we did this in the end, but it needn't require a:focus. We can expand the media label with a focusin/focusout behaviour on the media item wrapper.

There are some other problem links too. The table view has links in the author column which are also unnecessary (they take you away from the dialog). That could be changed to a plain text author name.

wim leers’s picture

Can we clean that up at the same time?

+1 — because those are partial work-arounds for the same problem.

There are some other problem links too.

Let's not to do those in this issue. One problem at a time, so that we can get improvements committed without getting stuck :)

gease’s picture

StatusFileSize
new7.94 KB

Removed a link from all displays and added an edit link to page admin display.

wim leers’s picture

Status: Active » Needs review

Thanks, @gease!

wim leers’s picture

Issue tags: +DevDaysCluj
seanb’s picture

This is a great first start. Thanks!

As discussed with gease this needs some input from a design/UX perspective on how to place and style the edit link.

Besides that we probably needs an update path to also update the view in existing sites and have some tests to assert the link is gone.

gease’s picture

StatusFileSize
new9.73 KB
new1.62 KB

Added some tests.

seanb’s picture

Issue tags: -Needs design
StatusFileSize
new176.15 KB
new177.02 KB
new177.93 KB

We are removing the link in the view mode, which means we have to add a separate edit link for the view display for /admin/content/media.
We have discussed this in the UX call. The screenshots below visualise what this could look like.

Before / current:
Before

Only a edit link:
Example with edit button

Edit link and delete button:
Edit and delete example

Another thought, the view on admin/content/media-table also includes a delete link for each item. I think it might be good to also add the delete link. I know it's a bit of a scope creep, but since we need to have an update hook and tests to update the view, it might be efficient to add the edit and delete button in 1 issue to minimise the updates on the view configuration.

phenaproxima’s picture

Transferring credit for @mcannon, myself, @HeikkiY, and @lauriii from #3041111: Items selected from the media library cannot be reordered by weight, which I'm closing as a duplicate. We should copy the tests from that issue into this one, since it adds some valuable coverage.

phenaproxima’s picture

phenaproxima’s picture

Status: Needs review » Needs work

Kicking back to "needs work" for tests to be copied from #3041111: Items selected from the media library cannot be reordered by weight.

gease’s picture

StatusFileSize
new13.54 KB
new4.99 KB

Finished restyling "edit" link and hook_update_N() without still considering comment #15.

phenaproxima’s picture

Status: Needs work » Needs review

Let's see how the tests feel...

gease’s picture

gease’s picture

StatusFileSize
new16.4 KB
new2.72 KB

Added "delete media" icon to media library page. Unless some community review fails, nothing more I can add here.

gease’s picture

StatusFileSize
new34.32 KB
new35.27 KB

Comparison of current 8.8.x media library items on content admin page without and with patch:
BeforeAfter

seanb’s picture

Thanks @gease. This is coming along really nice! This looks like a huge improvement to me.

Some feedback on the patch. The feedback in #7 also does not seem to be addressed.

  1. +++ b/core/modules/media_library/config/install/views.view.media_library.yml
    @@ -414,6 +414,219 @@ display:
    +            text: '<div class="media-library-item__edit"></div>'
    ...
    +            text: '<div class="media-library-item__remove"></div>'
    

    We should probably override the field classes instead of providing an empty div.

  2. +++ b/core/modules/media_library/config/install/views.view.media_library.yml
    @@ -414,6 +414,219 @@ display:
    +          hide_alter_empty: true
    +          text: ' '
    +          output_url_as_text: false
    ...
    +          hide_alter_empty: true
    +          text: ' '
    +          output_url_as_text: false
    

    I think we need a textual fallback for the links (for a11y purposes).

  3. +++ b/core/modules/media_library/css/media_library.module.css
    @@ -63,7 +63,7 @@
    +  bottom: 44px;
    

    Are we sure this is always 44px?

  4. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -312,6 +312,7 @@
     .media-library-item--grid:before {
    ...
    +  pointer-events: none;
    

    Why do we need this?

  5. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -446,27 +447,20 @@
    -.media-library-item__attributes:hover .media-library-item__name a,
    -.media-library-item__name a:focus,
    -.media-library-item--grid.is-focus .media-library-item__name a,
    -.media-library-item--grid.checked .media-library-item__name a {
    +.media-library-item__attributes:hover .media-library-item__name,
    +.media-library-item--grid.is-focus .media-library-item__name,
    +.media-library-item--grid.checked .media-library-item__name {
       white-space: normal;
     }
    

    Do we still need this? It seemed to be specific for the link styles.

  6. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -519,7 +513,16 @@
    +.media-library-item__remove.button:focus,
    +.media-library-item__edit,
    +.media-library-item__edit:hover,
    +.media-library-item__edit:focus,
    +.media-library-item__edit.button,
    +.media-library-item__edit.button:first-child,
    +.media-library-item__edit.button:disabled,
    +.media-library-item__edit.button:disabled:active,
    +.media-library-item__edit.button:hover,
    +.media-library-item__edit.button:focus {
    
    @@ -532,16 +535,48 @@
    +.media-library-item__remove,
    +.media-library-item__remove:hover,
    +.media-library-item__remove:focus,
    +.media-library-item__remove.button,
    +.media-library-item__remove.button:first-child,
    +.media-library-item__remove.button:disabled,
    +.media-library-item__remove.button:disabled:active,
    +.media-library-item__remove.button:hover,
    +.media-library-item__remove.button:focus {
    ...
    +.media-library-item__edit,
    +.media-library-item__edit:hover,
    +.media-library-item__edit:focus,
    +.media-library-item__edit.button,
    +.media-library-item__edit.button:first-child,
    +.media-library-item__edit.button:disabled,
    +.media-library-item__edit.button:disabled:active,
    +.media-library-item__edit.button:hover,
    +.media-library-item__edit.button:focus {
    

    I know it already sucked a bit, but with the new additions I hope we can find a better way to write this :(

  7. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -532,16 +535,48 @@
    +.views-field-edit-media .media-library-item__edit {
    

    Can we removed .views-field-edit-media?

  8. +++ b/core/modules/media_library/media_library.install
    @@ -218,3 +219,18 @@ function media_library_update_8702() {
    +    $view->set('display.page.display_options.fields', $view_config['display']['page']['display_options']['fields']);
    +    $view->set('display.page.display_options.defaults', $view_config['display']['page']['display_options']['defaults']);
    

    I think we need to be a bit more specific. When a user has changed the media_library view on an existing site this would override their changes. We probably need to make sure we only make additions.

    We should also have a test for this.

  9. +++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
    @@ -104,6 +104,12 @@ public function testAdministrationPage() {
    +    $assert_session->elementExists('css', '.media-library-item .views-field-edit-media');
    

    Can we have an extra test for the delete link as well?

  10. +++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
    @@ -433,6 +439,14 @@ public function testWidget() {
    +    $assert_session->elementTextContains('css', '.views-display-link-widget.is-active', 'Grid');
    

    I don't think we need this line here.

  11. +++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
    @@ -433,6 +439,14 @@ public function testWidget() {
    +    $assert_session->elementNotExists('css', '.media-library-item--grid .media-library-item__name a');
    

    I think we can do: $assert_session->elementNotExists('css', '.media-library-item__name a');

    The name should never have an anchor in it if I'm not mistaken.

  12. +++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
    @@ -104,6 +104,12 @@ public function testAdministrationPage() {
    @@ -433,6 +439,14 @@ public function testWidget() {
    

    Can we have explicit tests for the widget that there are no links to edit/delete media from the media library? This could be done in a separate issue, but since the solution we chose here is chosen partly to make sure the edit/delete link are NOT in the media library widget, it might be good to assert that.

gease’s picture

Thanks @seanB for the thorough review.
I'll go step by step:

The feedback in #7 also does not seem to be addressed.

Comment #7 has three distinct notes.

As well as the CSS pointer-events: none, there is a JS keypress listener which tries to "fix" this for by presenting a confirmation dialog. Can we clean that up at the same time?

I am planning to cleanup js with the issue #3062375: Media library item loses focus when hovering over item's title.

There's another side to this which is that we expand the size of the link when it has focus, to avoid truncating the media label. I don't recall how we did this in the end, but it needn't require a:focus. We can expand the media label with a focusin/focusout behaviour on the media item wrapper.

It's expanded on hover over container.

There are some other problem links too. The table view has links in the author column which are also unnecessary (they take you away from the dialog). That could be changed to a plain text author name.

This should be a separate ticket, if at all.

rosinegrean’s picture

Issue tags: -DevDaysCluj +DevDaysTransylvania
gease’s picture

We should probably override the field classes instead of providing an empty div.

If we just override the class, the icon won't be a link. I think I've taken the most transparent way (that is, with the least amount of code and overrides).

I think we need a textual fallback for the links (for a11y purposes).

You are correct, I thought about this (after posting the last patch). Will do it.

Are we sure this is always 44px?

All the margins, offsets, sizes for those icons are given in pixels. And I see no breakpoints or anything. So yes, we are sure.

Why do we need this?

Good question. I turned it off and see no regression. And for sure don't remember clearly why I've put it there. I can guess that before restyling "edit" and "delete" links it prevented clicking them. I can remove it now.

Do we still need this? It seemed to be specific for the link styles.

No, it's for the title. It's part of "show full title on hover" functionality.

I know it already sucked a bit, but with the new additions I hope we can find a better way to write this :(

Basically, I see no reason for putting all kinds of pseudo-selectors, but I kept it as it was, assuming it was done for some reason.

Can we removed .views-field-edit-media?

No, because we have media widget and media page, and edit button is positioned differently in those cases.

gease’s picture

I think we need to be a bit more specific. When a user has changed the media_library view on an existing site this would override their changes. We probably need to make sure we only make additions.

We should also have a test for this.

Agree about the test, will add check that there is an edit and delete links on media page. What concerns the view, I'm overriding just the fields of the display concerned. Of course, we can be more granular and just add "edit" and "delete", but chances are this will mess up users' overrides. Overall I don't think it's a best practice to override third-party views.

Can we have an extra test for the delete link as well?

Btw, the test for "edit" is there. So just the same for "delete" to be added.

I don't think we need this line here.

To make sure we are in grid view. If you think this is superfluous, I'll remove it.

The name should never have an anchor in it if I'm not mistaken.

At least, this sounds quite logical. I'll try.

Can we have explicit tests for the widget that there are no links to edit/delete media from the media library? This could be done in a separate issue, but since the solution we chose here is chosen partly to make sure the edit/delete link are NOT in the media library widget, it might be good to assert that.

Ok, I will add these. There is a "remove" button on a widget, but it's an input element, so no problem.

gease’s picture

New patch as per above comments.
pointer-events: none;
comes from #3041111: Items selected from the media library cannot be reordered by weight, items weights are not clickable.

lauriii’s picture

lauriii’s picture

seanb’s picture

StatusFileSize
new21.89 KB
new26.04 KB

Attached is a new patch with some code changes:

  • Tried a different approach to add the edit/delete link classes in the view.
  • In the edit/delete links we now use the media name for a11y purposes (or else it's harder to figure out what you are actually deleting)
  • Updated CSS, added some documentation about the list of overrides we need because of the way the .button class is built and fixed RTL styling.
  • Move the "Unpublished" label back to the top since the name can be variable in height. Positioning 44px from the bottom caused the name to display on top of the label when it was too long.
  • Changed the update hook to be more specific about the fields we want to add.

Only thing I believe we are still missing is a test for the update hook.

After that, we need to demo this to the UX team and get a11y and frontend maintainer signoff since we made some pretty significant UX/frontend changes.

seanb’s picture

Issue summary: View changes
StatusFileSize
new1.52 MB
new1.48 MB

Updated IS and screenshots.

UI before:
Media library with edit link in name.

Updated UI:
Media library with edit and delete buttons.

Status: Needs review » Needs work

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

seanb’s picture

We showed a demo of this issue today in the UX meeting (you can watch that here https://www.youtube.com/watch?v=aipwkFhZDms). We also had a11y people present. The general consensus was that everyone liked the approach and implementation. The following non-blocking comment were made, we need to have followups for that:

  1. The checkbox is a little too small (at least in chrome for MacOS). It need to look about the same size as the edit/delete buttons.
  2. The status label positioning could be improved.
  3. The focus styles of the checkbox and buttons could be improved. The focus style could get lost on certain images.

As mentioned, these things need followups. I will however remove the a11y and UX review tags.

What is left for this issue:

  • Add update hook tests
  • Fix the coding style issues
  • Create followups
seanb’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new33.45 KB
new51.11 KB

Fixed code style issues and added update test.

phenaproxima’s picture

Status: Needs review » Needs work

This is really close to ready, and a huge win.

  1. --- a/core/modules/media_library/config/install/views.view.media_library.yml
    +++ b/core/modules/media_library/config/install/views.view.media_library.yml
    

    It looks like we have only added things to this view, and not removed anything. I thought we'd be removing some stuff too?

  2. +++ b/core/modules/media_library/css/media_library.module.css
    @@ -85,13 +89,6 @@
    -/* @todo Remove or re-work in https://www.drupal.org/node/2985168 */
    -.media-library-widget .media-library-item__name a,
    -.media-library-view--widget .media-library-item__name a,
    -.media-library-add-form__selected-media .media-library-item__name a {
    -  pointer-events: none;
    -}
    

    Have we properly dealt with the referenced issue? (i.e., is it closed or triaged correctly in relation to this one?)

  3. +++ b/core/modules/media_library/css/media_library.module.css
    @@ -106,3 +103,7 @@
    +.views-live-preview .media-library-view div.views-row + div.views-row {
    +  margin-top: 0;
    +}
    

    This could use a comment.

  4. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -312,6 +312,7 @@
     .media-library-item--grid:before {
       position: absolute;
    +  pointer-events: none;
    

    Why are we adding pointer-events: none here?

  5. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -510,7 +508,21 @@
    + * We have to override the .button styles since for a lot of selectors buttons
    + * make heave use of background and border property changes.
    

    What is meant by "a lot of selectors buttons"? Also, "heave" should be "heavy" :)

  6. +++ b/core/modules/media_library/media_library.install
    @@ -218,3 +218,218 @@ function media_library_update_8702() {
    +function media_library_update_8703() {
    

    Should this maybe be a post-update hook, so we can take advantage of the Views and entity APIs?

  7. +++ b/core/modules/media_library/media_library.install
    @@ -218,3 +218,218 @@ function media_library_update_8702() {
    +  if ($view && $view->get('display.page')) {
    

    $view will always be truthy, even if the view has been deleted. We should check if (!$view->isNew()).

  8. +++ b/core/modules/media_library/media_library.install
    @@ -218,3 +218,218 @@ function media_library_update_8702() {
    +    // Check if the edit link field already exist and add if it doesn't.
    

    s/exist/exists

  9. +++ b/core/modules/media_library/media_library.install
    @@ -218,3 +218,218 @@ function media_library_update_8702() {
    +    $view->set('display.page.display_options.fields', $fields);
    +    $view->save(TRUE);
    

    Nit: These calls can be changed.

  10. +++ b/core/modules/media_library/tests/src/Functional/Update/MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest.php
    @@ -0,0 +1,52 @@
    +/**
    + * Tests the media library module updates for the view page display links.
    + *
    + * @group media_library
    + * @group legacy
    + */
    +class MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest extends UpdatePathTestBase {
    

    Do we, by any chance, have an existing update path test we could merge this into?

  11. +++ b/core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTest.php
    @@ -435,6 +442,15 @@ public function testWidget() {
    +    $page->find('css', '.ui-dialog-titlebar-close')->click();
    

    This should be $assert_session->elementExists()->click(), to prevent potential method calls on NULL.

lauriii’s picture

  1. I didn't participate in any discussions around this, but this seems to introduce a new design pattern. Did you discuss whether you could use contextual links for this? I'm not against introducing a new design pattern, but it would be nice to at least have it documented why we couldn't use the pre-existing pattern for this.
  2. +++ b/core/modules/media_library/css/media_library.module.css
    @@ -51,22 +51,26 @@
    +  left: 5px;
    

    This should document that this is for LTR.

  3. +++ b/core/modules/media_library/css/media_library.module.css
    @@ -106,3 +103,7 @@
    +.views-live-preview .media-library-view div.views-row + div.views-row {
    +  margin-top: 0;
    +}
    

    Maybe we should open a follow-up against Views UI for this.

  4. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -499,6 +493,10 @@
       right: 5px;
    

    This should be marked as LTR.

  5. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -510,7 +508,21 @@
    + * Media library widget edit and delete button styles.
    + *
    + * We have to override the .button styles since for a lot of selectors buttons
    + * make heave use of background and border property changes.
    ...
    +.media-library-item__edit.button,
    +.media-library-item__edit.button:first-child,
    +.media-library-item__edit.button:disabled,
    +.media-library-item__edit.button:disabled:active,
    +.media-library-item__edit.button:hover,
    +.media-library-item__edit.button:focus,
    

    Where can I test this version of the element where the element has .button? Could we remove the .button class from the element to simplify this?

  6. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -523,20 +535,61 @@
    +  right: 40px;
    

    This should be marked as LTR.

  7. +++ b/core/modules/media_library/css/media_library.theme.css
    @@ -523,20 +535,61 @@
    +  right: 10px;
    

    This should be marked as LTR.

phenaproxima’s picture

wim leers’s picture

#35: That screenshot looks great! This is part of the work that #3023807-12: Override media fields from the reference field proposed 👍

I'm also building on top of this in #2998005-51: [PP-1] Support Drupal core's Media Library, which @phenaproxima cross-posted with me 🤓

seanb’s picture

Status: Needs work » Needs review
StatusFileSize
new52.12 KB
new65.47 KB

Fixed the tests.

#40

1. We removed the link in the template.
2. The referenced issue #2985168: [PP-1] Allow media items to be edited in a modal when using the field widget is already closed as won't fix. Actually removing the edit link should be the end of it. So I think we are good.
3. Fixed.
4. To fix #3041111: Items selected from the media library cannot be reordered by weight
5. Fixed.
6. Not sure, we have done this in regular update hooks before so I thought it would be good to stick with the same pattern.
7. Nice catch, thanks.
8. Fixed.
9. Fixed.
10. Technically we could merge it into any existing update path test, but since those fixtures would be older the test would not just the test the new update hook. In the past we tried merge update path tests but I was lead to believe having a separate test for each update hook was the way to go. I personally have no strong preference, but if we can merge update tests we probably need to refactor existing update tests as well (in a follow up).
11. This exact line is in the MediaLibraryTest test 11 times. So fixed all occurrences.

#41

1. This has been discussed in the UX meeting twice, but the general consensus seemed to be that these links needed to be directly visible instead of hidden behind a contextual link button or in a dropbutton. Not sure what/where to document?
2. Fixed.
3. The views code below was added to views in 2009. Never noticed this issue before though. Added #3064914: Views preview adds margin top to views rows to see if this can be removed.

/* The div.views-row is intentional and excludes li.views-row, for example */
.views-live-preview div.views-row + div.views-row {
  margin-top: 36px;
}

4. Fixed.
5. Fixed. The media library widget (when adding a media field to a node for example) contains a delete button when you have selected media from the library. Since this is a form submit, it automatically gets the button class from core. We could remove the extra styles for the .media-library-item__edit since we don't have an edit button in the widget yet. This will probably be added in #3023807: Override media fields from the reference field, but we will see about that when we get there I guess.
6. Fixed.
7. Fixed.

phenaproxima’s picture

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

Patch no longer applies. I think it needs a reroll :)

seanb’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new65.5 KB

Rerolled #44.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

I gave this a quick manual test. I installed Drupal from HEAD, then enabled Media Library. I then applied the patch and ran the database update, which went flawlessly. Then I logged in as admin and went to /admin/content/media, added a couple of media items, then navigated into them with the keyboard (which worked great!) and the mouse (which also worked great!). I was able to select them, edit them, and delete them without any issue.

It also worked admirably on a clean install. I think this is done.

chr.fritsch’s picture

+++ b/core/modules/media_library/media_library.install
@@ -218,3 +218,218 @@ function media_library_update_8702() {
+function media_library_update_8703() {
+  $view = \Drupal::configFactory()->getEditable('views.view.media_library');
+  if (!$view->isNew() && $view->get('display.page')) {
+    // Fetch the fields from the page display, if the fields are not yet

For updating some config in an update hook, we usually use the ConfigEntityUpdater. For example, see block_content_post_update_add_views_reusable_filter()

I think we should do that here as well.

phenaproxima’s picture

For updating some config in an update hook, we usually use the ConfigEntityUpdater. For example, see block_content_post_update_add_views_reusable_filter()

I don't know if that's necessary here, since we're only modifying a single config entity, and we're doing it using the low-level config system...

phenaproxima’s picture

Issue summary: View changes

Minor IS update.

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
StatusFileSize
new9.63 KB
new9.29 KB

#44.1 I think having it in this issue is enough (at least now it's somewhere).
#44.5 Can we open follow-up to figure out if it would be possible to remove the automatically added classes?

It seems like the field widget remove button has some issues with the positioning of the cross:
Chrome:

Firefox:

Other than that the frontend changes look good to me.

starshaped’s picture

StatusFileSize
new1.74 MB

I just tried reproducing the cross alignment issues from #51, and I'm not able to reproduce it. I took this screenshot on a Retina Macbook Pro; Chrome 75.0.3770.100 on the left and Firefox 67.0.3 on the right.

phenaproxima’s picture

StatusFileSize
new195.51 KB

So...I am reproducing this problem on a non-Retina MacBook Air. However, the weird thing is that the problem disappears if I zoom in; only at the default zoom level do I see it. Here's a screenshot; Chrome is on the left, Firefox on the right.

The problem...

phenaproxima’s picture

StatusFileSize
new194.83 KB

This is a weird problem. Fiddling with it in the web inspector, I discovered that, on my machine at least, changing the background-size of the X to 14px solves the problem. Screenshot attached; Chrome on the left, Firefox on the right.

The solution?

lauriii’s picture

It seems to be some kind of rounding issue. Changing the background size changes the size of the icon, so we probably should increase the size of the button as well to keep the design consistent. If that doesn't work, there are some other, more complex workarounds we could look into.

Edit: another solution would be to just change the size of the button, without changing the background size. For example, increasing the size by 1px seems very minor change to the design, and fixes the rounding issue on 100% zoom.

starshaped’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new66.11 KB
new445 bytes
new550.43 KB

Increased the button size, and now the X looks good in both Firefox and Chrome.

phenaproxima’s picture

Looks good to me; thanks @starshaped!!

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new175.54 KB

I filed #3065431: Allow buttons to opt out of getting the 'button' class to handle the button class snafu.

I also look another quick look at the changes from @starshaped. Looks great in both Chrome and Firefox at 100% zoom:

A/B comparison of the new buttons in Chrome and Firefox

I think we're done here. Green once testbot catches up.

phenaproxima’s picture

wim leers’s picture

Whew, I didn't expect cross-browser CSS issues to suddenly appear! Now I'm extra glad that I made #2994702: Allow editors to alter embed-specific metadata, as well as `data-align` and `data-caption` reuse this patch's CSS rather than duplicating it 😅

alexpott’s picture

StatusFileSize
new1.06 KB
new65.67 KB

This patch introduces some css coding standards regressions. You can find this out by doing:

cd core
yarn run lint:css

And fix this by doing adding --fix to the command.

alexpott’s picture

StatusFileSize
new2.19 KB
new65.48 KB
+++ b/core/modules/media_library/templates/media--media-library.html.twig
--- /dev/null
+++ b/core/modules/media_library/tests/fixtures/update/drupal-8.media_library-update-view-page-display-edit-delete-link-3039829.php

+++ b/core/modules/media_library/tests/fixtures/update/drupal-8.media_library-update-view-page-display-edit-delete-link-3039829.php
+++ b/core/modules/media_library/tests/fixtures/update/drupal-8.media_library-update-view-page-display-edit-delete-link-3039829.php
@@ -0,0 +1,111 @@

@@ -0,0 +1,111 @@
+<?php
+// @codingStandardsIgnoreFile
+/**
+ * @file
+ * Contains database additions to drupal-8.bare.standard.php.gz for testing
+ * the upgrade paths of the media library module widget view.
+ *
+ * @see https://www.drupal.org/project/drupal/issues/3020716
+ */

+++ b/core/modules/media_library/tests/src/Functional/Update/MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest.php
@@ -0,0 +1,52 @@
+  protected function setDatabaseDumpFiles() {
+    $this->databaseDumpFiles = [
+      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
+      __DIR__ . '/../../../../../media/tests/fixtures/update/drupal-8.4.0-media_installed.php',
+      __DIR__ . '/../../../fixtures/update/drupal-8.media_library-update-view-page-display-edit-delete-link-3039829.php',
+    ];

The @see is not correct. And the docs aren't really either - it's for adding on top of drupal-8.4.0-media_installed.php.

I think we should call this drupal-8.7.2-media_library_installed.php as this file is probably more generic than just for this specific issue. And remove the @see

Also we should file a follow-up issue to rename and merge core/modules/media_library/tests/fixtures/update/drupal-8.media_library-update-view-table-display-2981044.php and core/modules/media_library/tests/fixtures/update/drupal-8.media_library-update-widget-view-3020716.php to whatever version of media library install they represent.

Leaving rtbc as this is naming things.

phenaproxima’s picture

effulgentsia’s picture

Crediting @andrewmacpherson for review.

  • effulgentsia committed 7da933b on 8.8.x
    Issue #3039829 by gease, seanB, alexpott, starshaped, phenaproxima, Wim...
effulgentsia’s picture

Status: Reviewed & tested by the community » Fixed

Pushed to 8.8.x.

wim leers’s picture

phenaproxima’s picture

I would like to nominate this patch to be backported to 8.7.x, since it’s a significant accessibility improvement in an experimental module.

phenaproxima’s picture

Issue tags: +backport
xjm’s picture

Issue tags: -backport

While this is indeed a good accessibility improvement, I think it's too disruptive to backport the item for a patch release (given the update hook, UI changes, etc.). I would leave this one as 8.8-only for now unless it's blocking other accessibility bugfixes or unless the issue is more severe than I understand.

Thanks!

catch’s picture

Status: Fixed » Needs work

This should probably have been a post update rather than hook_update_N(). If we're not going to backport it, it creates a conflict if we did want to backport another update in the future. Also the update is just updating a config entity.

effulgentsia’s picture

Hm, should we have a followup that moves it to a post_update, and leaves behind an empty media_library_update_8703()? Then we can backport just the empty media_library_update_8703() to 8.7 to prevent future number conflict? Or the entire a11y fix if we decide to?

gagarine’s picture

Apparently this bug is the cause of #3041111: Items selected from the media library cannot be reordered by weight. Can we at least provide a patch that fix this issue? It's unusable in a lot of use case.

xjm’s picture

Assigned: Unassigned » phenaproxima
Issue tags: +Needs followup

Adam will create a followup for the update issue.

phenaproxima’s picture

phenaproxima’s picture

Status: Needs work » Fixed
Related issues: +#3084043: Convert media_library_update_8703() to a post-update hook

The follow-up has been created and is now RTBC, so I think this can be marked fixed.

Status: Fixed » Closed (fixed)

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