Skip to content

fix(backup-codes): minor UI issues and JS var leak#801

Merged
masteradhoc merged 1 commit intoWordPress:masterfrom
sjinks:fix/backup-codes
Feb 24, 2026
Merged

fix(backup-codes): minor UI issues and JS var leak#801
masteradhoc merged 1 commit intoWordPress:masterfrom
sjinks:fix/backup-codes

Conversation

@sjinks
Copy link
Contributor

@sjinks sjinks commented Feb 21, 2026

What?

This pull request updates the markup structure and JavaScript in the backup codes provider to fix HTML issues. It also updates related tests to match these changes.

Markup improvements:

  • Changed the main container in user_options from a <p> to a <div> because it is illegal to nest <p> tags.
  • Corrected misplaced closing tags.

JavaScript update:

  • Prevented leakage of the i variable into the global scope.

Test updates:

  • Updated the tests to match the changes.

Why?

Correctness and maintainability.

How?

  • For nested <p> tags, replaced the outermost <p> with a <div>;
  • For the misplaced tags, converted them into closing tags.

Testing Instructions

CI must pass - I have updated the tests.

Screenshots or screencast

N/A

Changelog Entry

Fixed - Minor markup and JS issues in the Backup Code provider.


// Append the codes.
for ( i = 0; i < response.codes.length; i++ ) {
for ( var i = 0; i < response.codes.length; i++ ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leaked i into the global scope.

Comment on lines -162 to 163
<p id="two-factor-backup-codes">
<div id="two-factor-backup-codes">
<p class="two-factor-backup-codes-count">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<p> tags cannot be nested; <p> allows only for phrasing content.

@sjinks sjinks marked this pull request as ready for review February 21, 2026 12:54
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sjinks <volodymyrkolesnykov@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Collaborator

@masteradhoc masteradhoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@georgestephanis georgestephanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They all look reasonable and good fixes to me.

@masteradhoc masteradhoc merged commit 8bb0ea7 into WordPress:master Feb 24, 2026
35 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Two Factor project board Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants