diff --git a/core/modules/media_library/css/media_library.theme.css b/core/modules/media_library/css/media_library.theme.css index 63337b922c..a0c35c5cd2 100644 --- a/core/modules/media_library/css/media_library.theme.css +++ b/core/modules/media_library/css/media_library.theme.css @@ -399,25 +399,29 @@ background-position: left 2px; } -.media-library-add-form .media-library-add-form__remove-button:hover, .media-library-add-form .media-library-add-form__remove-button:focus, -.media-library-add-form .media-library-add-form__remove-button.button, .media-library-add-form .media-library-add-form__remove-button.button:disabled, .media-library-add-form .media-library-add-form__remove-button.button:disabled:active, -.media-library-add-form .media-library-add-form__remove-button.button:hover, .media-library-add-form .media-library-add-form__remove-button.button:focus { + color: #787878; + background: transparent url(../../../misc/icons/787878/ex.svg) right 2px no-repeat; /* LTR */ +} +[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button:focus, +[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:disabled, +[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:disabled:active, +[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:focus { + background-position: left 2px; +} + +.media-library-add-form .media-library-add-form__remove-button:hover, +.media-library-add-form .media-library-add-form__remove-button.button:hover { color: #e00; border: 0; background: transparent url(../../../misc/icons/ee0000/ex.svg) right 2px no-repeat; /* LTR */ box-shadow: none; } [dir="rtl"] .media-library-add-form .media-library-add-form__remove-button:hover, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button:focus, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:disabled, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:disabled:active, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:hover, -[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:focus { +[dir="rtl"] .media-library-add-form .media-library-add-form__remove-button.button:hover { background-position: left 2px; } diff --git a/core/modules/media_library/src/Form/AddFormBase.php b/core/modules/media_library/src/Form/AddFormBase.php index ea1b5734ca..aa0c1fb105 100644 --- a/core/modules/media_library/src/Form/AddFormBase.php +++ b/core/modules/media_library/src/Form/AddFormBase.php @@ -181,7 +181,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { protected function buildEntityFormElement(MediaInterface $media, array $form, FormStateInterface $form_state, $delta) { // We need to make sure each button has a unique name attribute. The default // name for button elements is 'op'. If the name is not unique, the - // triggering element is not set correctly. + // triggering element is not set correctly and the wrong media item is + // removed. // @see ::removeButtonSubmit() $parents = $form['#parents']; $id_suffix = $parents ? '-' . implode('-', $parents) : ''; @@ -206,7 +207,7 @@ protected function buildEntityFormElement(MediaInterface $media, array $form, Fo 'wrapper' => 'media-library-add-form-wrapper', ], '#submit' => ['::removeButtonSubmit'], - // Prevent errors in other media items from preventing removal. + // Ensure errors in other media items do not prevent removal. '#limit_validation_errors' => [], ], 'preview' => [