diff --git a/core/modules/quickedit/quickedit.module b/core/modules/quickedit/quickedit.module
index 2d69a66..be40115 100644
--- a/core/modules/quickedit/quickedit.module
+++ b/core/modules/quickedit/quickedit.module
@@ -117,7 +117,10 @@ function quickedit_field_formatter_info_alter(&$info) {
  * Implements hook_preprocess_HOOK() for the page title template.
  */
 function quickedit_preprocess_page_title(&$variables) {
-  $variables['title_attributes']['class'][] = 'js-quickedit-page-title';
+  $variables['#cache']['contexts'][] = 'user.permissions';
+  if (\Drupal::currentUser()->hasPermission('access in-place editing')) {
+    $variables['title_attributes']['class'][] = 'js-quickedit-page-title';
+  }
 }
 
 /**
diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
index 2a91fec..6cda648 100644
--- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php
@@ -103,10 +103,11 @@ public function testUserWithoutPermission() {
     $this->assertNoRaw('core/modules/quickedit/js/quickedit.js', 'Quick Edit library not loaded.');
     $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js', "'form' in-place editor not loaded.");
 
-    // HTML annotation does not exist for users without permission to in-place
-    // edit.
+    // HTML annotation and title class does not exist for users without
+    // permission to in-place edit.
     $this->assertNoRaw('data-quickedit-entity-id="node/1"');
     $this->assertNoRaw('data-quickedit-field-id="node/1/body/en/full"');
+    $this->assertNoFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]');
 
     // Retrieving the metadata should result in an empty 403 response.
     $post = array('fields[0]' => 'node/1/body/en/full');
@@ -157,9 +158,11 @@ public function testUserWithPermission() {
     $this->assertTrue(in_array('quickedit/quickedit', $libraries), 'Quick Edit library loaded.');
     $this->assertFalse(in_array('quickedit/quickedit.inPlaceEditor.form', $libraries), "'form' in-place editor not loaded.");
 
-    // HTML annotation must always exist (to not break the render cache).
+    // HTML annotation and title class must always exist (to not break the
+    // render cache).
     $this->assertRaw('data-quickedit-entity-id="node/1"');
     $this->assertRaw('data-quickedit-field-id="node/1/body/en/full"');
+    $this->assertFieldByXPath('//h1[contains(@class, "js-quickedit-page-title")]');
 
     // There should be only one revision so far.
     $node = Node::load(1);
