Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#51877 closed defect (bug) (fixed)

Twenty Twenty: Wrong parameter name used in searchform.php

Reported by: poena's profile poena Owned by: sabernhardt's profile sabernhardt
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch commit
Focuses: Cc:

Description

In searchform.php, the parameter/argument that is used is named
$args['label'], the correct name for use with get_search_form() is $args['aria_label'].

See https://developer.wordpress.org/reference/functions/get_search_form/#parameters

Attachments (2)

51877.patch (680 bytes) - added by vipulc2 4 years ago.
Wrong parameter name used in searchform.php in Twenty Twenty changed $argslabel? to $argsaria_label?
51877.2.patch (2.5 KB) - added by sabernhardt 4 years ago.
editing argument to aria-label in get_search_form() functions for 3 files, and updating searchform.php to give a fallback for child theme templates that might use label

Download all attachments as: .zip

Change History (9)

#1 @sabernhardt
4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Would this be a good first bug?

In addition to replacing 'label' with 'aria_label', Twenty Twenty's searchform template still needs to accept 'label' as a valid parameter (if used in a child theme).

@vipulc2
4 years ago

Wrong parameter name used in searchform.php in Twenty Twenty changed $argslabel? to $argsaria_label?

#2 @kishanjasani
4 years ago

Thanks for Patch @vipulc2. Looks good to me.

@sabernhardt
4 years ago

editing argument to aria-label in get_search_form() functions for 3 files, and updating searchform.php to give a fallback for child theme templates that might use label

#3 @sabernhardt
4 years ago

  • Keywords has-patch added; needs-patch removed

This was a little more complicated than I had thought it might be. In addition to updating the argument in 4 files, 51877.2.patch adds a fallback for child theme backward compatibility.

#4 @sabernhardt
4 years ago

  • Milestone changed from Future Release to 5.8
  • Owner set to sabernhardt
  • Status changed from new to accepted

#5 @mukesh27
3 years ago

Just review 51877.2.patch and it working fine.

Marking commit for the action.

Ping @SergeyBiryukov

#6 @sabernhardt
3 years ago

  • Keywords commit added

#7 @davidbaumwald
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 50933:

Twenty Twenty: Correct label attribute references to aria_label in get_search_form.

In the bundled Twenty Twenty theme, a label argument was passed to get_search_form but used as the aria_label on the form. This change updates the argument name to aria_label and maintains backwards compatibility for usage of the original label argument.

Props poena, sabernhardt, ipulc2, kishanjasani, mukesh27.
Fixes #51877.

Note: See TracTickets for help on using tickets.