smartcar / javascript-sdk

Client-side JS SDK for OAuth dialogs.
MIT License
9 stars 5 forks source link

jQuery should be removed from generated button click listeners. #19

Closed sankethkatta closed 6 years ago

sankethkatta commented 6 years ago

Using native click listeners does not register properly in our demo websites. There are no errors, however clicking on the appropriate buttons does not trigger the listener:

Reproduction steps:

  1. Revert to previous revision of javascript-sdk. The jQuery code was removed in the jump from 0.0.20 to 0.0.21. It was added back in 0.0.25.
  2. Serve /src directory on a local server python3 -m http.server.
  3. Clone the demos repo: git clone git@github.com:smartcar/demos.git.
  4. Edit fueled-homepage.html#L91 to point the SDK script to http://localhost:8000/sdk.js (or wherever you are serving it)
  5. Open the fueled-homepage.html in the browser and try to click on any of the Login buttons. The click listener does not trigger.

NOTE: remove the honda make out of the list on fueled-homepage if you downgrade to an sdk version below 0.0.23.

sankethkatta commented 6 years ago

Investigation revealed that the lightbox library used in the fueled-homepage (featherlight) was messing with the buttons listeners on open/close. Developers may use libs like featherlight, so our solution should be robust to work around it.

Currently the solution is to use onclick attributes directly on the buttons. In the long-term the buttons should be rendered inside a smartcar-served iFrame.