Commit 23abd14ad1e for woocommerce
commit 23abd14ad1e142b13b1606838ee31b76aad1d240
Author: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
Date: Mon Aug 31 10:20:01 2026 +0200
Improve password visibility button markup construction (#68174)
* Harden password visibility button markup construction
* Add changelog entry for password markup hardening
diff --git a/plugins/woocommerce/changelog/codex-fix-woo6-107 b/plugins/woocommerce/changelog/codex-fix-woo6-107
new file mode 100644
index 00000000000..a274bc5f42b
--- /dev/null
+++ b/plugins/woocommerce/changelog/codex-fix-woo6-107
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Harden password visibility toggle markup handling.
diff --git a/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js b/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
index 362f5e7e03e..48d530c2f95 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/woocommerce.js
@@ -122,13 +122,14 @@ jQuery( function ( $ ) {
$( '.password-input' ).each( function () {
const describedBy = $( this ).find( 'input' ).attr( 'id' );
- $( this ).append(
- '<button type="button" class="show-password-input" aria-label="' +
- woocommerce_params.i18n_password_show +
- '" aria-describedBy="' +
- describedBy +
- '"></button>'
- );
+ const $button = $( '<button>', {
+ type: 'button',
+ class: 'show-password-input',
+ 'aria-label': woocommerce_params.i18n_password_show,
+ } );
+
+ $button.attr( 'aria-describedby', describedBy );
+ $( this ).append( $button );
} );
$( '.show-password-input' ).on( 'click', function ( event ) {