diff --git a/core/lib/Drupal/Component/Utility/Html.php b/core/lib/Drupal/Component/Utility/Html.php
index f9bb8e6a23..c83a435b01 100644
--- a/core/lib/Drupal/Component/Utility/Html.php
+++ b/core/lib/Drupal/Component/Utility/Html.php
@@ -95,7 +95,6 @@ public static function getClass($class) {
   public static function cleanCssIdentifier($identifier, array $filter = [
     ' ' => '-',
     '_' => '-',
-    '/' => '-',
     '[' => '-',
     ']' => '',
   ]) {
@@ -115,13 +114,17 @@ public static function cleanCssIdentifier($identifier, array $filter = [
 
     // Valid characters in a CSS identifier are:
     // - the hyphen (U+002D)
+    // - the period (U+002E)
+    // - the slash (U+002F)
+    // - the colon (U+003A)
     // - a-z (U+0030 - U+0039)
+    // - the @ sign (U+0040)
     // - A-Z (U+0041 - U+005A)
     // - the underscore (U+005F)
     // - 0-9 (U+0061 - U+007A)
     // - ISO 10646 characters U+00A1 and higher
     // We strip out any character not in the above list.
-    $identifier = preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $identifier);
+    $identifier = preg_replace('/[^\x{002D}\x{002E}\x{002F}\x{003A}\x{0030}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $identifier);
     // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit.
     $identifier = preg_replace([
       '/^[0-9]/',
diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
index fc3df609e0..b4554a3769 100644
--- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
+++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
@@ -295,14 +295,14 @@ public function testBlockEmptyRendering() {
 
     $block = $this->drupalPlaceBlock('views_block:test_view_block-block_1', ['label' => 'test_view_block-block_1:1', 'views_label' => 'Custom title']);
     $this->drupalGet('');
-    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-blocktest-view-block-block-1")]', 1);
+    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-block:test-view-block-block-1")]', 1);
 
     $display = &$view->getDisplay('block_1');
     $display['display_options']['block_hide_empty'] = TRUE;
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "block-views-blocktest-view-block-block-1")]');
+    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "block-views-block:test-view-block-block-1")]');
     // Ensure that the view cacheability metadata is propagated even, for an
     // empty block.
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
@@ -322,7 +322,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-blocktest-view-block-block-1")]', 1);
+    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-block:test-view-block-block-1")]', 1);
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
 
@@ -340,7 +340,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "block-views-blocktest-view-block-block-1")]');
+    $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "block-views-block:test-view-block-block-1")]');
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
 
@@ -357,7 +357,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-blocktest-view-block-block-1")]', 1);
+    $this->assertSession()->elementsCount('xpath', '//div[contains(@class, "block-views-block:test-view-block-block-1")]', 1);
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
   }
@@ -391,8 +391,8 @@ public function testBlockContextualLinks() {
     $this->getSession()->getDriver()->getClient()->request('POST', $url, $post);
     $this->assertSession()->statusCodeEquals(200);
     $json = Json::decode($this->getSession()->getPage()->getContent());
-    $this->assertSame('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$id]);
-    $this->assertSame('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $cached_block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$cached_id]);
+    $this->assertSame('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="entity.view.edit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$id]);
+    $this->assertSame('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $cached_block->id() . '">Configure block</a></li><li class="entity.view.edit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$cached_id]);
   }
 
 }
