diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 4d134b5..172d8e3 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2398,16 +2398,10 @@ function template_preprocess_field(&$variables, $hook) {
   // Add default CSS classes. Since there can be many fields rendered on a page,
   // save some overhead by calling strtr() directly instead of
   // drupal_html_class().
-  $variables['entity_type_css'] = strtr($element['#entity_type'], '_', '-');
-  $variables['field_name_css'] = strtr($element['#field_name'], '_', '-');
-  $variables['field_type_css'] = strtr($element['#field_type'], '_', '-');
-  $variables['attributes']['class'] = array(
-    'field',
-    'field-' . $variables['entity_type_css'] . '--' . $variables['field_name_css'],
-    'field-name-' . $variables['field_name_css'],
-    'field-type-' . $variables['field_type_css'],
-    'field-label-' . $element['#label_display'],
-  );
+  $variables['entity_type'] = $element['#entity_type'];
+  $variables['field_name'] = $element['#field_name'];
+  $variables['field_type'] = $element['#field_type'];
+  $variables['label_display'] = $element['#label_display'];
   // Add a "clearfix" class to the wrapper since we float the label and the
   // field items in field.module.css if the label is inline.
   if ($element['#label_display'] == 'inline') {
diff --git a/core/modules/system/templates/field.html.twig b/core/modules/system/templates/field.html.twig
index d38b028..37f2d84 100644
--- a/core/modules/system/templates/field.html.twig
+++ b/core/modules/system/templates/field.html.twig
@@ -16,22 +16,37 @@
  * - field.html.twig
  *
  * Available variables:
- * - attributes: HTML attributes for the containing element.
  * - label_hidden: Whether to show the field label or not.
  * - title_attributes: HTML attributes for the title.
  * - label: The label for the field.
  * - content_attributes: HTML attributes for the content.
  * - items: List of all the field items.
  * - item_attributes: List of HTML attributes for each item.
+ * - attributes: HTML attributes for the containing element.
+ *  - entity_type: The entity type to which the field belongs.
+ *  - field_name: The name of the field.
+ *  - field_type: The type of the field.
+ *  - label_display: The display of the label for the field.
  *
  * @see template_preprocess_field()
  *
  * @ingroup themeable
  */
 #}
-<div{{ attributes }}>
+
+{%
+  set classes = [
+    'field',
+    'field-' ~ entity_type|clean_class ~ '--' ~ field_name|clean_class,
+    'field-name-' ~ field_name|clean_class,
+    'field-type-' ~ field_type|clean_class,
+    'field-label-' ~ label_display|clean_class
+  ]
+%}
+
+<div {{ attributes.addClass(classes, attributes.class) }}>
   {% if not label_hidden %}
-    <div class="field-label{% if title_attributes.class %} {{ title_attributes.class }}{% endif %}"{{ title_attributes|without('class') }}>{{ label }}:&nbsp;</div>
+    <div class="field-label"{{ title_attributes }}>{{ label }}:&nbsp;</div>
   {% endif %}
   <div class="field-items"{{ content_attributes }}>
     {% for delta, item in items %}
