Skip to content

Escaped submenu toggle aria-label attributes#4546

Open
girishpanchal30 wants to merge 1 commit into
developmentfrom
bugfix/4503
Open

Escaped submenu toggle aria-label attributes#4546
girishpanchal30 wants to merge 1 commit into
developmentfrom
bugfix/4503

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Escaped the title for the toggle button in the navigation menu to ensure that it is safe for use in HTML attributes. This prevents potential security vulnerabilities such as XSS attacks.

Check before Pull Request is ready:

Closes #4503

@girishpanchal30
girishpanchal30 requested a review from Copilot July 17, 2026 12:50
@girishpanchal30 girishpanchal30 added the pr-checklist-skip Allow this Pull Request to skip checklist. label Jul 17, 2026
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Escapes dynamic mobile submenu labels to prevent malformed HTML attributes and XSS risks.

Changes:

  • Builds the toggle label separately.
  • Applies attribute-context escaping before rendering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread inc/views/nav_walker.php
$caret .= $caret_pictogram;
$caret .= '</button>';
$toggle_aria_label = __( 'Toggle', 'neve' ) . ' ' . wp_filter_nohtml_kses( $title );
$caret = '<button ' . $expanded . ' type="button" class="caret-wrap navbar-toggle ' . esc_attr( (string) $item->menu_order ) . ' ' . esc_attr( $additional_class ) . '" style="' . esc_attr( $caret_wrap_css ) . '" aria-label="' . esc_attr( $toggle_aria_label ) . '">';
@pirate-bot

Copy link
Copy Markdown
Collaborator

Plugin build for b66e0d8 is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile submenu toggle aria-label can break for quoted menu item titles

4 participants