screen-reader-text class causing labels to disappear
-
Hello!
Similar to reports here and here, we experienced problem with checkout form field labels disappearing from the checkout page after doing some field updates.
After investigation, we found out that the problem is field “address_2” having an attribute “label_class” which is not supported (displayed or editable) by this plugin, but may get unintentionally copied over to other fields behind the scenes.
The label class “screen-reader-text” is being handled in plugin’s function “add_billing_fields_beta”, but only for “address_2”.
The unintentional copying-over happens when the “Previous”/”Next” buttons are used in the field editing modal window – if the user has “address_2” editing popup opened and then navigates to a previous or next field, the new field data are retrieved by a “wooccm_load_field” AJAX call, which are then loaded into the active field Backbone model by
model.set(). The model object is not reset/cleared beforehand, so it keeps the “label_class” data of the previously used “address_2” model, even though other fields do not have that attribute.If the user now, for example, adds some product filter for this field and saves it, the “label_class” attribute get saved into the field, it gets class “screen-reader-text” on the frontend, which makes it visually disappear.
I tested this with the latest plugin version 7.8.6. Also, I’m not sure if “address_2” has that label class on a clean new WordPress install, as we had that field from several years ago, but even then it may still be a problem for users as seen in the reports, and the plugin’s code is specifically handling that attribute for “address_2”, too.
Please, fix this bug.
Best regards,
Janis
You must be logged in to reply to this topic.