verygoodsecurity / vgs-collect-js

VGS Collect.js script loading module
https://www.verygoodsecurity.com/
7 stars 17 forks source link

isFocused property not getting updated on inputs of type "zip-code" #37

Open ali-ebner opened 2 years ago

ali-ebner commented 2 years ago

Expected Behavior

The isFocused property in the form state should get updated on focus and blur for vgs form fields of type zip-code

Current Behavior

isFocused does not get updated for zip-code inputs

Steps to Reproduce (for bugs)

Code pen example: https://codepen.io/ali_ebner/pen/NWXBvjM?editors=1111

  1. Put your cursor into the zip code field or start typing into this field
  2. Check the output of the card-zip form state in the console. See that isFocused remains false even though other fields update
  3. Remove focus from the zip code field
  4. See that other form fields update but isFocused remains false/unchanged

Context

Styles and other behaviors that are dependent on the isFocused state for this field are not applying. Current workaround is to use field.on('focus') and field.on('blur') and then update React state to keep track of focus for this field.

Your Environment

AnnaKudriasheva commented 2 years ago

Thank you @ali-ebner for pointing this out! We're working on the fix.

AnnaKudriasheva commented 2 years ago

@ali-ebner we've fixed it in the scope of the VGS Collect.js 2.13.0 version. Please try it out and let us know if the issue with the focused state still appears. Thanks!