Skip to content

Conversation

@claytoncollie
Copy link
Contributor

This PR addresses #41 to fix the alignment and accessibility of checkbox and radio fields in the wp-admin settings pages. The markup has been updated to match WordPress Core patterns for form controls. This is a refactor, not a functionality change.

Changes made:

  1. Checkbox fields (Gutenberg.php, PostPasswords.php):

    • Removed label_for argument from add_settings_field() since checkboxes shouldn't have the row label linked to them
    • Wrapped inputs in <label> elements with description text inside, matching Core's checkbox pattern
  2. Radio fields (Passwords.php, Monitor.php):

    • Removed label_for argument from add_settings_field() for radio groups
    • Added <fieldset> wrapper with <legend class="screen-reader-text"> for accessibility
    • Each radio input is now wrapped in its corresponding <label> element

Benefits:

  • Improved accessibility and keyboard usability
  • Consistent markup with WordPress Core admin patterns
  • Better screen reader support with proper fieldset/legend structure for radio groups

Closes #41

How to test the Change

  1. Install the plugin on a local WordPress instance
  2. Navigate to and verify the following settings pages:
    • Writing Settings (/wp-admin/options-writing.php):
      • "Use Classic Editor" checkbox - verify label is clickable
      • "Enable Password Protected Content" checkbox - verify label is clickable
    • General Settings (/wp-admin/options-general.php):
      • "Require Strong Passwords" radio buttons - verify Yes/No labels are clickable
      • "Enable Support Monitor" radio buttons - verify Yes/No labels are clickable
    • Network Settings (multisite only - /wp-admin/network/settings.php):
      • "Require Strong Passwords" radio buttons - verify proper fieldset structure
  3. Save each setting multiple times to ensure functionality is preserved
  4. Use a screen reader or browser accessibility tools to verify the fieldset/legend structure

Changelog Entry

Changed - Updated admin markup for checkbox and radio fields to match WordPress Core accessibility patterns

Credits

Props @claytoncollie

Checklist:

@darylldoyle
Copy link
Contributor

@claytoncollie thank you for putting this together! Can we also do this for Disable Comments and Allow Fueled SSO, please? They're left looking slightly odd without the style updates.

CleanShot 2025-12-18 at 12 04 28

@claytoncollie
Copy link
Contributor Author

@darylldoyle Refactored Comments and SSO on single and multisite

Copy link
Contributor

@darylldoyle darylldoyle left a comment

Choose a reason for hiding this comment

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

Great work!

@darylldoyle darylldoyle added this to the 1.18.0 milestone Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alignment Issue in the Writing Settings page.

2 participants