Update consent banner and allow tabindex
This is necessary to allow keyboard users to access the consent banner without having to go through ALL elements of the page first.
This commit is contained in:
parent
d331062285
commit
b1e6edadc6
@ -710,8 +710,8 @@ define( 'FICTIONEER_OPTIONS', array(
|
||||
'group' => 'fictioneer-settings-phrases-group',
|
||||
'sanitize_callback' => 'fictioneer_validate_phrase_cookie_consent_banner',
|
||||
'label' => __( 'Cookie Consent Banner', 'fictioneer' ),
|
||||
'default' => __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank">Privacy Policy</a>.', 'fictioneer' ),
|
||||
'placeholder' => __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank">Privacy Policy</a>.', 'fictioneer' )
|
||||
'default' => __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank" tabindex="1">Privacy Policy</a>.', 'fictioneer' ),
|
||||
'placeholder' => __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank" tabindex="1">Privacy Policy</a>.', 'fictioneer' )
|
||||
),
|
||||
'fictioneer_phrase_comment_reply_notification' => array(
|
||||
'name' => 'fictioneer_phrase_comment_reply_notification',
|
||||
@ -993,11 +993,24 @@ function fictioneer_validate_email_address( $input ) {
|
||||
*/
|
||||
|
||||
function fictioneer_validate_phrase_cookie_consent_banner( $input ) {
|
||||
$default = _x( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank">Privacy Policy</a>.', 'Cookie consent banner content default.', 'fictioneer' );
|
||||
// Setup
|
||||
global $allowedtags;
|
||||
$default = __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank" tabindex="1">Privacy Policy</a>.', 'fictioneer' );
|
||||
|
||||
// Return default if input is empty
|
||||
if ( ! is_string( $input ) ) return $default;
|
||||
|
||||
return strlen( $input ) < 32 ? $default : wp_kses_post( $input );
|
||||
// Temporarily allow tabindex attribute
|
||||
$allowedtags['a']['tabindex'] = [];
|
||||
|
||||
// Apply KSES
|
||||
$output = wp_kses( stripslashes_deep( $input ), $allowedtags );
|
||||
|
||||
// Disallow tabindex attribute
|
||||
unset( $allowedtags['a']['tabindex'] );
|
||||
|
||||
// Return
|
||||
return strlen( $input ) < 32 ? $default : $output;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -76,7 +76,7 @@ $pagenum = isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
|
||||
<div class="overflow-horizontal">
|
||||
<div class="textarea row">
|
||||
<?php
|
||||
$default = esc_html( __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank">Privacy Policy</a>.', 'fictioneer' ) );
|
||||
$default = esc_html( __( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank" tabindex="1">Privacy Policy</a>.', 'fictioneer' ) );
|
||||
?>
|
||||
<textarea name="fictioneer_phrase_cookie_consent_banner" id="fictioneer_phrase_cookie_consent_banner" rows="4" placeholder="<?php echo $default; ?>"><?php echo esc_attr( get_option( 'fictioneer_phrase_cookie_consent_banner' ) ); ?></textarea>
|
||||
<p class="sub-label"><?php _e( 'HTML allowed. <code>[[privacy_policy_url]]</code>', 'fictioneer' ) ?></p>
|
||||
|
@ -12,17 +12,17 @@
|
||||
<div class="consent-banner__wrapper">
|
||||
<?php
|
||||
$info = fictioneer_replace_key_value(
|
||||
wp_kses_post( get_option( 'fictioneer_phrase_cookie_consent_banner' ) ),
|
||||
get_option( 'fictioneer_phrase_cookie_consent_banner' ),
|
||||
array(
|
||||
'[[privacy_policy_url]]' => get_privacy_policy_url()
|
||||
),
|
||||
__( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank">Privacy Policy</a>.', 'fictioneer' )
|
||||
__( 'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. Some features are not available without, but you can limit the site to strictly necessary cookies only. See <a href="[[privacy_policy_url]]" target="_blank" tabindex="1">Privacy Policy</a>.', 'fictioneer' )
|
||||
);
|
||||
?>
|
||||
<p class="consent-banner__notice"><?php echo $info; ?></p>
|
||||
<div class="consent-banner__actions">
|
||||
<button type="button" id="consent-accept-button" class="button button--cookie-banner"><?php _e( 'Accept', 'fictioneer' ) ?></button>
|
||||
<button type="button" id="consent-reject-button" class="button button--cookie-banner"><?php _e( 'Reject Non-Essential', 'fictioneer' ) ?></button>
|
||||
<button type="button" id="consent-accept-button" class="button button--cookie-banner" tabindex="2"><?php _e( 'Accept', 'fictioneer' ) ?></button>
|
||||
<button type="button" id="consent-reject-button" class="button button--cookie-banner" tabindex="3"><?php _e( 'Reject Non-Essential', 'fictioneer' ) ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user