Credit card fields still required when a $0 option is selected on event registration/contribution page
Overview
When submitting an event registration (or contribution page form) with a $0 price option selected the form fails validation, despite credit card fields being hidden. I noticed this on a CiviCRM website I manage, reproduced on the circle interactive demo site, also @KarinG reproduced this on yet another site.
https://chat.civicrm.org/civicrm/pl/aer7pqut5b85t8ab83ax3iko3o
Reproduction steps
- Go to an event registration page (or contribution page)
- Select $0 price option
- Submit form
Current behaviour
Expected behaviour
Credit card fields should not be required when they're hidden.
Environment information
- Browser: Chrome 84.0.4147.89
- CiviCRM: 5.28.0
- PHP: 7.2.31
- CMS: Drupal 7.72
- Database: MySQL 5.7.31
- Web Server: _Apache 2.4.46
Comments
Works as intended on CiviCRM 5.26.2 but not 5.28.0