diff --git a/core/modules/media_library/src/Form/AddFormBase.php b/core/modules/media_library/src/Form/AddFormBase.php
index 05f2596c032459beab3c33a2ef5a1fec4b18d123..869c3842134d3ad7d3b803e7c23e7a3303f9d70a 100644
--- a/core/modules/media_library/src/Form/AddFormBase.php
+++ b/core/modules/media_library/src/Form/AddFormBase.php
@@ -14,6 +14,7 @@
 use Drupal\Core\Form\BaseFormIdInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Form\WorkspaceSafeFormInterface;
 use Drupal\Core\Render\Element;
 use Drupal\Core\Security\TrustedCallbackInterface;
 use Drupal\Core\Url;
@@ -27,7 +28,7 @@
 /**
  * Provides a base class for creating media items from within the media library.
  */
-abstract class AddFormBase extends FormBase implements BaseFormIdInterface, TrustedCallbackInterface {
+abstract class AddFormBase extends FormBase implements BaseFormIdInterface, TrustedCallbackInterface, WorkspaceSafeFormInterface {
 
   /**
    * The entity type manager.
diff --git a/core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php b/core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php
index e6b8174c104afed6988a383ae5832443861b3872..2e233cab5e468815d41a3327cd9fd7343ed28a0d 100644
--- a/core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php
+++ b/core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php
@@ -7,6 +7,7 @@
 use Drupal\Core\Ajax\MessageCommand;
 use Drupal\Core\Form\FormBuilderInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Form\WorkspaceSafeFormInterface;
 use Drupal\Core\Url;
 use Drupal\media_library\MediaLibraryState;
 use Drupal\views\Attribute\ViewsField;
@@ -22,7 +23,7 @@
  *   Plugin classes are internal.
  */
 #[ViewsField("media_library_select_form")]
-class MediaLibrarySelectForm extends FieldPluginBase {
+class MediaLibrarySelectForm extends FieldPluginBase implements WorkspaceSafeFormInterface {
 
   /**
    * {@inheritdoc}
diff --git a/core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesMediaLibraryIntegrationTest.php b/core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesMediaLibraryIntegrationTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..83ecb8e434f9e7fc8dd7bf3635d36c208aab90f3
--- /dev/null
+++ b/core/modules/workspaces/tests/src/FunctionalJavascript/WorkspacesMediaLibraryIntegrationTest.php
@@ -0,0 +1,67 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\workspaces\FunctionalJavascript;
+
+use Drupal\Tests\media_library\FunctionalJavascript\EntityReferenceWidgetTest;
+use Drupal\user\UserInterface;
+use Drupal\workspaces\Entity\Workspace;
+
+/**
+ * Tests the Media library entity reference widget in a workspace.
+ *
+ * @group workspaces
+ */
+class WorkspacesMediaLibraryIntegrationTest extends EntityReferenceWidgetTest {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected static $modules = [
+    'workspaces',
+  ];
+
+  /**
+   * An array of test methods that are not relevant for workspaces.
+   */
+  const SKIP_METHODS = [
+    // This test does not assert anything that can be workspace-specific.
+    'testFocusNotAppliedWithoutSelectionChange',
+    // This test does not assert anything that can be workspace-specific.
+    'testRequiredMediaField',
+    // This test tries to edit an entity in Live after it has been edited in a
+    // workspace, which is not currently possible.
+    'testWidgetPreview',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp(): void {
+    if (in_array($this->name(), static::SKIP_METHODS, TRUE)) {
+      $this->markTestSkipped('Irrelevant for this test');
+    }
+
+    parent::setUp();
+
+    // Ensure that all the test methods are executed in the context of a
+    // workspace.
+    $stage = Workspace::load('stage');
+    \Drupal::service('workspaces.manager')->setActiveWorkspace($stage);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function drupalCreateUser(array $permissions = [], $name = NULL, $admin = FALSE, array $values = []): UserInterface|false {
+    // Ensure that users and roles are managed outside a workspace context.
+    return \Drupal::service('workspaces.manager')->executeOutsideWorkspace(function () use ($permissions, $name, $admin, $values) {
+      $permissions = array_merge($permissions, [
+        'view any workspace',
+      ]);
+      return parent::drupalCreateUser($permissions, $name, $admin, $values);
+    });
+  }
+
+}