diff --git a/src/bp-core/bp-core-template.php b/src/bp-core/bp-core-template.php
index b7a4e41c7..a7ec55806 100644
--- a/src/bp-core/bp-core-template.php
+++ b/src/bp-core/bp-core-template.php
@@ -792,7 +792,14 @@ function bp_form_field_attributes( $name = '', $attributes = array() ) {
 		$attributes = (array) apply_filters( 'bp_get_form_field_attributes', $attributes, $name );
 
 		foreach( $attributes as $attr => $value ) {
-			$retval .= sprintf( ' %s="%s"', sanitize_key( $attr ), esc_attr( $value ) );
+			// Numeric keyed array.
+			if (is_numeric( $attr ) ) {
+				$retval .= sprintf( ' %s', esc_attr( $value ) );
+
+			// Associative keyed array.
+			} else {
+				$retval .= sprintf( ' %s="%s"', sanitize_key( $attr ), esc_attr( $value ) );
+			}
 		}
 
 		return $retval;
diff --git a/src/bp-xprofile/classes/class-bp-xprofile-field-type.php b/src/bp-xprofile/classes/class-bp-xprofile-field-type.php
index f282a826c..69fe89928 100644
--- a/src/bp-xprofile/classes/class-bp-xprofile-field-type.php
+++ b/src/bp-xprofile/classes/class-bp-xprofile-field-type.php
@@ -509,6 +509,7 @@ abstract class BP_XProfile_Field_Type {
 		) );
 
 		if ( bp_get_the_profile_field_is_required() ) {
+			$r[]                = 'required';
 			$r['aria-required'] = 'true';
 		}
 
