Skip to content

Commit

Permalink
Jetpack Tweaks: Enable jetpack forms package, update accessibility fi…
Browse files Browse the repository at this point in the history
…x to work on package version

Follow up to #874
See https://wordpress.slack.com/archives/C08M59V3P/p1696266125242069
  • Loading branch information
ryelle committed Oct 2, 2023
1 parent c3449bf commit 134340c
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace WordCamp\Jetpack_Tweaks;
use WP_Service_Worker_Caching_Routes, WP_Service_Worker_Scripts;
use Grunion_Contact_Form;

defined( 'WPINC' ) || die();

Expand Down Expand Up @@ -205,11 +204,8 @@ function workaround_is_frontend( $is_frontend ) {
* @param int|null $post_id Post ID.
*/
function wrap_checkbox_radio_fieldset( $rendered_field, $field_label, $post_id ) {
// Get the current form style, if it's anything other than default, return early.
$class_name = Grunion_Contact_Form::$current_form->get_attribute( 'className' );
preg_match( '/is-style-([^\s]+)/i', $class_name, $matches );
$style = count( $matches ) >= 2 ? $matches[1] : 'default';
if ( 'default' !== $style ) {
// If the field uses "animated" or "notched" UI, return early.
if ( str_contains( $rendered_field, 'animated-label__label' ) || str_contains( $rendered_field, 'notched-label__label' ) ) {
return $rendered_field;
}

Expand Down Expand Up @@ -278,6 +274,3 @@ function inject_css_for_fieldset() {
wp_add_inline_style( 'grunion.css', $form_css );
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\inject_css_for_fieldset' );

// Default forms in Jetpack got switched in 12.2, and the fix for accessibility (wrap_checkbox_radio_fieldset) breaks when upgrading: to 12.2+.
add_filter( 'jetpack_contact_form_use_package', '__return_false' );

0 comments on commit 134340c

Please sign in to comment.