diff --git a/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php
index 529fe5ca1d14e1c91db0d0254640e249da60b1b8..6a518ef3eff0514365f6abf5272a8cfe9d3e4153 100644
--- a/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php
+++ b/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php
@@ -85,6 +85,7 @@ public function defaultConfiguration() {
   public function build() {
     $config = $this->configuration;
     $cacheability = new CacheableMetadata();
+    $cacheability->addCacheableDependency($this->localTaskManager);
     $tabs = [
       '#theme' => 'menu_local_tasks',
     ];
diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
index 48861f999b5d4b86680424c0e3daae3940b469c2..952ad623f6786d9c8fb10fd8fef55a5de026af96 100644
--- a/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
+++ b/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
@@ -86,6 +86,7 @@ public function testPageCacheTags() {
       'http_response',
       'rendered',
       'block_view',
+      'local_task',
       'config:block_list',
       'config:block.block.bartik_branding',
       'config:block.block.bartik_breadcrumbs',
@@ -127,6 +128,7 @@ public function testPageCacheTags() {
       'http_response',
       'rendered',
       'block_view',
+      'local_task',
       'config:block_list',
       'config:block.block.bartik_branding',
       'config:block.block.bartik_breadcrumbs',
diff --git a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
index 12a157d5879a2e0355f4f4c18964bd92eca67a0e..1a49336777ed8f82939303781a21b86d5404d2a2 100644
--- a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
@@ -18,7 +18,7 @@ class LocalTasksTest extends BrowserTestBase {
    *
    * @var string[]
    */
-  public static $modules = ['block', 'menu_test', 'entity_test'];
+  public static $modules = ['block', 'menu_test', 'entity_test', 'node'];
 
   /**
    * The local tasks block under testing.
@@ -253,4 +253,29 @@ public function testLocalTaskBlock() {
     $this->assertLocalTasks($sub_tasks, 1);
   }
 
+  /**
+   * Test that local tasks blocks cache is invalidated correctly.
+   */
+  public function testLocalTaskBlockCache() {
+    $this->drupalLogin($this->rootUser);
+    $this->drupalCreateContentType(['type' => 'page']);
+
+    $this->drupalGet('/admin/structure/types/manage/page');
+
+    // Only the Edit task. The block avoids showing a single tab.
+    $this->assertNoLocalTasks();
+
+    // Field UI adds the usual Manage fields etc tabs.
+    \Drupal::service('module_installer')->install(['field_ui']);
+
+    $this->drupalGet('/admin/structure/types/manage/page');
+
+    $this->assertLocalTasks([
+      ['entity.node_type.edit_form', ['node_type' => 'page']],
+      ['entity.node.field_ui_fields', ['node_type' => 'page']],
+      ['entity.entity_form_display.node.default', ['node_type' => 'page']],
+      ['entity.entity_view_display.node.default', ['node_type' => 'page']],
+    ]);
+  }
+
 }
diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php
index ac193909b392767116fb07d796906d9fdee57693..75b7b5cde797a64bd0ee7b5357287d72a6ced6b7 100644
--- a/core/modules/tracker/tests/src/Functional/TrackerTest.php
+++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php
@@ -93,6 +93,7 @@ public function testTrackerAll() {
     $expected_tags = Cache::mergeTags($expected_tags, $role_tags);
     $block_tags = [
       'block_view',
+      'local_task',
       'config:block.block.page_actions_block',
       'config:block.block.page_tabs_block',
       'config:block_list',
@@ -179,6 +180,7 @@ public function testTrackerUser() {
     $expected_tags = Cache::mergeTags($expected_tags, $role_tags);
     $block_tags = [
       'block_view',
+      'local_task',
       'config:block.block.page_actions_block',
       'config:block.block.page_tabs_block',
       'config:block_list',