| @@ -500,25 +500,17 @@ | ||
| 500 | 500 | if ( ! in_array( $field_type, array( 'radio', 'checkbox', 'data', 'product', 'scale' ), true ) ) { |
| 501 | 501 | return; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - $field = (array) $this->field_obj->get_field(); | |
| 505 | - $attributes = array(); | |
| 506 | - $is_radio = 'radio' === $field_type || 'scale' === $field_type; | |
| 507 | - $type_requires_aria_required = true; | |
| 504 | + $field = (array) $this->field_obj->get_field(); | |
| 505 | + $attributes = array(); | |
| 508 | 506 | |
| 509 | 507 | // Check if the field type is 'data' or 'product'. |
| 510 | 508 | if ( in_array( $field_type, array( 'data', 'product' ), true ) ) { |
| 511 | 509 | $data_type = FrmField::get_option( $field, 'data_type' ); |
| 512 | - // Check if the data type isn't 'radio' or 'checkbox'. | |
| 513 | - if ( 'radio' !== $data_type && 'checkbox' !== $data_type ) { | |
| 514 | - // If data type aren't 'radio' or 'checkbox', doesn't need to add 'aria-required' to multiple input container. | |
| 515 | - $type_requires_aria_required = false; | |
| 516 | - } | |
| 517 | - // Check if data type is 'radio' | |
| 518 | - if ( 'radio' === $data_type ) { | |
| 519 | - $is_radio = true; | |
| 520 | - } | |
| 510 | + $is_radio = 'radio' === $data_type; | |
| 511 | + } else { | |
| 512 | + $is_radio = 'radio' === $field_type || 'scale' === $field_type; | |
| 521 | 513 | } |
| 522 | 514 | |
| 523 | 515 | // Add 'role' attribute to the field. |
| 524 | 516 | $attributes['role'] = $is_radio ? 'radiogroup' : 'group'; |
| @@ -523,9 +515,9 @@ | ||
| 523 | 515 | // Add 'role' attribute to the field. |
| 524 | 516 | $attributes['role'] = $is_radio ? 'radiogroup' : 'group'; |
| 525 | 517 | |
| 526 | 518 | // Add 'aria-required' attribute to the field if required. |
| 527 | - if ( $type_requires_aria_required && '1' === $field['required'] ) { | |
| 519 | + if ( $is_radio && '1' === $field['required'] ) { | |
| 528 | 520 | $attributes['aria-required'] = 'true'; |
| 529 | 521 | } |
| 530 | 522 | |
| 531 | 523 | // Concatenate attributes into a string, and replace the role="group" in the HTML with the attributes string. |