-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed: aria-labelledby attribute handling to prevent double double quotes from outputting #1088 #1089
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related issues
Poem
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
templates/popup.php (1)
12-12
: Consider updating aria-modal value for better accessibility.The
aria-modal="false"
attribute might be misleading. According to ARIA specifications, if the dialog is intended to be modal, it should be set to"true"
, and if not modal, the attribute should be omitted entirely rather than set to"false"
.-<div id="pum-<?php pum_popup_ID(); ?>" role="dialog" aria-modal="false" +<div id="pum-<?php pum_popup_ID(); ?>" role="dialog" <?php echo pum_is_popup_modal() ? 'aria-modal="true"' : ''; ?>Consider adding a helper function
pum_is_popup_modal()
to determine if the popup should be modal.Would you like me to help create the helper function implementation?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
templates/popup.php
(1 hunks)
🧰 Additional context used
🪛 phpstan (2.0.3)
templates/popup.php
13-13: Function esc_attr not found.
Learn more at https://phpstan.org/user-guide/discovering-symbols
(function.notFound)
🔇 Additional comments (2)
templates/popup.php (2)
9-9
: Well-structured initialization of the aria-labelledby value!Good practices observed:
- Empty title check prevents unnecessary attribute output
- Consistent ID format using trusted source functions
12-14
: Secure and accessible implementation of aria-labelledby!The implementation properly escapes attributes and follows accessibility best practices.
🧰 Tools
🪛 phpstan (2.0.3)
13-13: Function esc_attr not found.
Learn more at https://phpstan.org/user-guide/discovering-symbols(function.notFound)
Description
This PR ensures proper attribute escaping to maintain security and prevent rendering issues in the DOM.
Since
pum_get_popup_title()
andpum_get_popup_id()
are trusted sources this could have been easily solved by removing theesc_attr
, but I opted to leave it for extra security and it may be required to meet WPCS.Related Issue: #1088 (Add proper escaping to
aria-labelledby
for popups)Types of changes
Bug fix.
Screenshots
This has been tested in the following browsers
Merge Checklist
Summary by CodeRabbit
aria-labelledby
attribute is constructed and rendered.