Fix pro issue 5410 / Use more descriptive names for name field subfie…#2029
Conversation
…lds to improve accessibility
WalkthroughThe changes in this pull request involve updates to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
classes/models/fields/FrmFieldName.php (1)
241-281: Effective implementation of accessibility warningThe new
show_after_defaultmethod is a great addition that aligns well with the PR's objective. It effectively checks for insufficiently descriptive subfield labels and provides a clear warning to guide users towards better accessibility practices.A minor suggestion for improvement:
Consider extracting the warning message text into a constant or a translatable string at the top of the class. This would make it easier to update or translate in the future. For example:
class FrmFieldName extends FrmFieldCombo { const ACCESSIBILITY_WARNING = 'Subfield descriptions are read by screen readers. Enhance accessibility by using complete labels, like "First Name" instead of "First".'; // ... rest of the class ... public function show_after_default( $args ) { // ... existing code ... echo esc_html__( self::ACCESSIBILITY_WARNING, 'formidable' ); // ... rest of the method ... } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- classes/models/fields/FrmFieldName.php (2 hunks)
🧰 Additional context used
🔇 Additional comments (2)
classes/models/fields/FrmFieldName.php (2)
36-38: Improved subfield labels for better accessibilityThe changes to the subfield labels are excellent. Using "First Name", "Middle Name", and "Last Name" instead of just "First", "Middle", and "Last" significantly improves clarity and accessibility. This aligns perfectly with the PR's objective of enhancing the user experience.
Line range hint
1-281: Overall assessment of changesThe modifications to the
FrmFieldNameclass effectively address the PR's objective of improving accessibility and using more descriptive names for name field subfields. The changes are well-integrated into the existing code structure and maintain consistency with the class's coding style.Key improvements:
- Updated subfield labels in the constructor for better clarity.
- New
show_after_defaultmethod to warn about insufficiently descriptive labels.These changes will significantly enhance the accessibility and user experience of forms created with the Formidable Forms plugin.
…lds to improve accessibility
Fixes https://github.com/Strategy11/formidable-pro/issues/5410
It also introduces this warning if "First" or "Last" is used.
