Skip to content

Commit

Permalink
Fix all <label>/<input> pairs for w3c validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kprovance committed Jul 1, 2023
1 parent 76c84e8 commit ce696ef
Show file tree
Hide file tree
Showing 29 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion redux-core/assets/css/redux-fields.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion redux-core/assets/css/redux-fields.min.css.map

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions redux-core/assets/js/redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,19 +805,17 @@ function colorNameToHex( colour ) {
};

$.redux.disableFields = function() {
$( 'label[for="redux_disable_field"]' ).each(
$( 'tr.redux_disable_field' ).each(
function() {
$( this ).parents( 'tr' ).find( 'fieldset:first' ).find( 'input, select, textarea' ).attr( 'name', '' );
}
);
};

$.redux.hideFields = function() {
$( 'label[for="redux_hide_field"]' ).each(
$( 'tr.redux_hide_field' ).each(
function() {
var tr = $( this ).parent().parent();

$( tr ).addClass( 'hidden' );
$( this ).addClass( 'hidden' );
}
);
};
Expand Down
2 changes: 1 addition & 1 deletion redux-core/assets/js/redux.min.js

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions redux-core/assets/js/redux/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,17 @@
};

$.redux.disableFields = function() {
$( 'label[for="redux_disable_field"]' ).each(
$( 'tr.redux_disable_field' ).each(
function() {
$( this ).parents( 'tr' ).find( 'fieldset:first' ).find( 'input, select, textarea' ).attr( 'name', '' );
}
);
};

$.redux.hideFields = function() {
$( 'label[for="redux_hide_field"]' ).each(
$( 'tr.redux_hide_field' ).each(
function() {
var tr = $( this ).parent().parent();

$( tr ).addClass( 'hidden' );
$( this ).addClass( 'hidden' );
}
);
};
Expand Down
4 changes: 2 additions & 2 deletions redux-core/inc/classes/class-redux-options-constructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,11 @@ public function register() {
$this->no_panel[] = $field['id'];
} else {
if ( isset( $field['disabled'] ) && $field['disabled'] ) {
$field['label_for'] = 'redux_disable_field';
$field['class'] = 'redux_disable_field';
}

if ( isset( $field['hidden'] ) && $field['hidden'] ) {
$field['label_for'] = 'redux_hide_field';
$field['class'] = 'redux_hide_field';
}

if ( true === $core->args['options_api'] ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class="redux-field-container redux-field redux-field-init redux-container-custom

if ( $can_convert ) {
echo '<div class="">';
echo '<label>';
echo '<label for="custom-font-convert">';
echo '<input type="hidden" class="checkbox-check" data-val="1" name="' . esc_attr( $this->field['name'] ) . '[convert]" value="' . esc_attr( $this->value['convert'] ) . '"/>';
echo '<input type="checkbox" class="checkbox" id="custom-font-convert" value="1"' . checked( $this->value['convert'], '1', false ) . '">';
echo 'Enable font conversion';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function render() {
// If split mode is on, output two text boxes.
if ( true === $split ) {
echo '<div class="redux-date-input input_wrapper">';
echo '<label class="redux-date-input-label">' . esc_html( $date_placeholder ) . '</label>';
echo '<label for="' . esc_attr( $field_id ) . '-date" class="redux-date-input-label">' . esc_html( $date_placeholder ) . '</label>';
echo ' <input
data-id="' . esc_attr( $field_id ) . '"
type="text"
Expand All @@ -192,10 +192,11 @@ class="redux-date-picker ' . esc_attr( $this->field['class'] ) . '" />&nbsp;&nbs
echo '</div>';

echo '<div class="redux-time-input input_wrapper">';
echo '<label class="redux-time-input-label">' . esc_html( $time_placeholder ) . '</label>';
echo '<label for="' . esc_attr( $field_id ) . '-time" class="redux-time-input-label">' . esc_html( $time_placeholder ) . '</label>';
echo ' <input
data-id="' . esc_attr( $field_id ) . '"
type="text" id="' . esc_attr( $field_id ) . '-time"
type="text"
id="' . esc_attr( $field_id ) . '-time"
name="' . esc_attr( $field_name ) . '[time]"
placeholder="' . esc_attr( $time_placeholder ) . '"
value="' . esc_attr( $this->value['time'] ) . '"
Expand All @@ -204,10 +205,11 @@ class="redux-time-picker ' . esc_attr( $this->field['class'] ) . '" />';
// Otherwise, just one.
} else {
echo '<div class="redux-datetime-input single_wrapper">';
echo '<label class="redux-datetime-input-label">' . esc_attr( $date_placeholder ) . '</label>';
echo '<label for="' . esc_attr( $field_id ) . '-date" class="redux-datetime-input-label">' . esc_attr( $date_placeholder ) . '</label>';
echo ' <input
data-id="' . esc_attr( $field_id ) . '"
type="text" id="' . esc_attr( $field_id ) . '-date"
type="text"
id="' . esc_attr( $field_id ) . '-date"
name="' . esc_attr( $field_name ) . '"
placeholder="' . esc_attr( $date_placeholder ) . '"
value="' . esc_attr( $this->value ) . '"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ public function add_footer_modal_icon() {
<div class="redux-modal-close redux-icon-close"></div>
</div>
<div class="redux-modal-header">
<label>
<select class="redux-icon-select-font"></select>
<label for="redux-icon-select-font">
<select class="redux-icon-select-font" id="redux-icon-select-font"></select>
</label>
<label>
<input type="text" placeholder="<?php esc_html_e( 'Search...', 'redux-framework' ); ?>" class="redux-icon-search"/>
<label for="redux-icon-search">
<input type="text" placeholder="<?php esc_html_e( 'Search...', 'redux-framework' ); ?>" class="redux-icon-search" id="redux-icon-search"/>
</label>
<div class="redux-modal-loading">
<div class="redux-loading"></div>
Expand Down
2 changes: 1 addition & 1 deletion redux-core/inc/extensions/search/redux-extension-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$( '.redux-container' ).each(
function( ) {
if ( ! $( this ).hasClass( 'redux-no-sections' ) ) {
$( this ).find( '.redux-main' ).prepend( '<input class="redux_field_search" type="text" placeholder="' + reduxSearch.search + '"/>' );
$( this ).find( '.redux-main' ).prepend( '<input class="redux_field_search" id="redux_field_search" type="text" placeholder="' + reduxSearch.search + '"/>' );
}
}
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ class="redux-social-profiles-hidden-data-' . esc_attr( $key ) . '"
$color_class = $color_pickers ? '' : ' no-color-pickers';

echo '<div class="redux-social-profiles-link-url input_wrapper' . esc_attr( $color_class ) . '">';
echo '<label class="redux-text-url-label">' . esc_html( $label ) . '</label>';
echo '<input class="redux-social-profiles-url-text" data-key="' . esc_attr( $key ) . '" type="text" value="' . esc_url( $url ) . '" />';
echo '<label for="redux-social-profiles-url-' . esc_attr( $key ) . '-text" class="redux-text-url-label">' . esc_html( $label ) . '</label>';
echo '<input id="redux-social-profiles-url-' . esc_attr( $key ) . '-text" class="redux-social-profiles-url-text" data-key="' . esc_attr( $key ) . '" type="text" value="' . esc_url( $url ) . '" />';
echo '</div>';

$reset_text = __( 'Reset', 'redux-framework' );
Expand All @@ -242,9 +242,10 @@ class="redux-social-profiles-hidden-data-' . esc_attr( $key ) . '"
$label = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/color_picker/text', esc_html__( 'Text', 'redux-framework' ) );

echo '<div class="redux-social-profiles-text-color picker_wrapper" >';
echo '<label class="redux-text-color-label">' . esc_html( $label ) . '</label>';
echo '<label for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text" class="redux-text-color-label">' . esc_html( $label ) . '</label>';
echo '<input
class="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text"
id="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text"
type="text"
value="' . esc_attr( $color ) . '"
data-key="' . esc_attr( $key ) . '"
Expand All @@ -255,9 +256,10 @@ class="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' text"
$label = apply_filters( 'redux/extensions/social_profiles/' . $this->opt_name . '/color_picker/background', esc_html__( 'Background', 'redux-framework' ) );

echo '<div class="redux-social-profiles-background-color picker_wrapper">';
echo '<label class="redux-background-color-label">' . esc_html( $label ) . '</label>';
echo '<label for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background" class="redux-background-color-label" for="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background">' . esc_html( $label ) . '</label>';
echo '<input
class="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background"
id="redux-social-profiles-color-picker-' . esc_attr( $key ) . ' background"
type="text"
value="' . esc_attr( $background ) . '"
data-key="' . esc_attr( $key ) . '"
Expand Down
8 changes: 4 additions & 4 deletions redux-core/inc/fields/box_shadow/class-redux-box-shadow.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function render() {
echo '</li>';
echo '<li>';
echo '<div class="slider-' . esc_attr( $shadow_type ) . '-horizontal">';
echo '<label>' . esc_html__( 'Horizontal Length ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['horizontal'] ) . 'px</strong></label>';
echo esc_html__( 'Horizontal Length ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['horizontal'] ) . 'px</strong>';
echo '<div
class="redux-box-shadow-slider redux-box-shadow-' . esc_attr( $shadow_type ) . ' redux-' . esc_attr( $shadow_type ) . '-horizontal ' . esc_attr( $shadow_type ) . '-horizontal-input ' . esc_attr( $this->field['class'] ) . '"
id="' . esc_attr( $this->field['id'] ) . '"
Expand All @@ -132,7 +132,7 @@ class="' . esc_attr( $shadow_type ) . '-horizontal"
echo '</li>';
echo '<li>';
echo '<div class="slider-' . esc_attr( $shadow_type ) . '-vertical">';
echo '<label>' . esc_html__( 'Vertical Length ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['vertical'] ) . 'px</strong></label>';
echo esc_html__( 'Vertical Length ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['vertical'] ) . 'px</strong>';
echo '<div
class="redux-box-shadow-slider redux-box-shadow-' . esc_attr( $shadow_type ) . ' redux-' . esc_attr( $shadow_type ) . '-vertical ' . esc_attr( $shadow_type ) . '-vertical-input ' . esc_attr( $this->field['class'] ) . '"
id="' . esc_attr( $this->field['id'] ) . '"
Expand All @@ -156,7 +156,7 @@ class="' . esc_attr( $shadow_type ) . '-vertical"
echo '</li>';
echo '<li>';
echo '<div class="slider-' . esc_attr( $shadow_type ) . '-blur">';
echo '<label>' . esc_html__( 'Blur Radius ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['blur'] ) . 'px</strong></label>';
echo esc_html__( 'Blur Radius ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['blur'] ) . 'px</strong>';
echo '<div
class="redux-box-shadow-slider redux-box-shadow-' . esc_attr( $shadow_type ) . ' redux-' . esc_attr( $shadow_type ) . '-blur ' . esc_attr( $shadow_type ) . '-blur-input ' . esc_attr( $this->field['class'] ) . '"
id="' . esc_attr( $this->field['id'] ) . '"
Expand All @@ -180,7 +180,7 @@ class="' . esc_attr( $shadow_type ) . '-blur"
echo '</li>';
echo '<li>';
echo '<div class="slider-' . esc_attr( $shadow_type ) . '-spread">';
echo '<label>' . esc_html__( 'Spread ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['spread'] ) . 'px</strong></label>';
echo esc_html__( 'Spread ', 'redux-framework' ) . ': <strong>' . esc_html( $this->value[ $shadow_type . '-shadow' ]['spread'] ) . 'px</strong>';
echo '<div
class="redux-box-shadow-slider redux-box-shadow-' . esc_attr( $shadow_type ) . ' redux-' . esc_attr( $shadow_type ) . '-spread ' . esc_attr( $shadow_type ) . '-spread-input ' . esc_attr( $this->field['class'] ) . '"
id="' . esc_attr( $this->field['id'] ) . '"
Expand Down
7 changes: 3 additions & 4 deletions redux-core/inc/fields/sortable/class-redux-sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ public function render() {

$class .= ' checkbox_sortable';
$name = '';

echo '<div class="checkbox-container">';
echo '<input
type="hidden"
name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '[' . esc_attr( $k ) . ']"
id="' . esc_attr( $this->field['id'] . '-' . $k ) . '-hidden"
value="' . esc_attr( $value_display ) . '" />';

echo '<div class="checkbox-container">';
} else {
$value_display = $this->value[ $k ] ?? '';
$nicename = $this->field['options'][ $k ];
Expand Down Expand Up @@ -169,9 +170,7 @@ class="' . esc_attr( $class ) . '" ' . esc_html( $checked ) . '
if ( 'checkbox' === $this->field['mode'] ) {
echo '<i class="dashicons dashicons-visibility visibility"></i>';

if ( 'checkbox' === $this->field['mode'] ) {
echo '<label for="' . esc_attr( $this->field['id'] . '[' . $k ) . ']"><strong>' . esc_html( $options[ $k ] ) . '</strong></label>';
}
echo '<strong>' . esc_html( $options[ $k ] ) . '</strong>';
}

if ( 'checkbox' === $this->field['mode'] ) {
Expand Down
4 changes: 2 additions & 2 deletions redux-core/inc/fields/switch/class-redux-switch.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function render() {
$this->field['off'] = $this->field['off'] ?? esc_html__( 'Off', 'redux-framework' );

echo '<div class="switch-options">';
echo '<label class="cb-enable' . esc_attr( $cb_enabled ) . '" data-id="' . esc_attr( $this->field['id'] ) . '"><span>' . esc_html( $this->field['on'] ) . '</span></label>';
echo '<label class="cb-disable' . esc_attr( $cb_disabled ) . '" data-id="' . esc_attr( $this->field['id'] ) . '"><span>' . esc_html( $this->field['off'] ) . '</span></label>';
echo '<div class="cb-enable label' . esc_attr( $cb_enabled ) . '" data-id="' . esc_attr( $this->field['id'] ) . '"><span>' . esc_html( $this->field['on'] ) . '</span></div>';
echo '<div class="cb-disable label' . esc_attr( $cb_disabled ) . '" data-id="' . esc_attr( $this->field['id'] ) . '"><span>' . esc_html( $this->field['off'] ) . '</span></div>';
echo '<input type="hidden" class="checkbox checkbox-input ' . esc_attr( $this->field['class'] ) . '" id="' . esc_attr( $this->field['id'] ) . '" name="' . esc_attr( $this->field['name'] . $this->field['name_suffix'] ) . '" value="' . esc_attr( $this->value ) . '" />';
echo '</div>';
}
Expand Down
Loading

0 comments on commit ce696ef

Please sign in to comment.