Skip to content

Commit

Permalink
Merge pull request #356 from recurly/defer-container-focus
Browse files Browse the repository at this point in the history
Adds field container click event deference
  • Loading branch information
snodgrass23 authored Jun 19, 2017
2 parents 2cdfd96 + a5c4325 commit aceab96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/recurly/hosted-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class HostedField extends Emitter {
this.isFocused = false;
this.configure(options);
this.inject();
this.bindLabel();
this.bindDeferredFocus();

this.on('bus:added', bus => {
this.bus = bus;
Expand Down Expand Up @@ -106,7 +106,8 @@ export class HostedField extends Emitter {
this.iframe.style.background = 'transparent';
}

bindLabel () {
bindDeferredFocus () {
this.container.addEventListener('click', this.focus);
if (!this.target.id) return;
const labels = global.document.querySelectorAll(`label[for=${this.target.id}]`);
[].slice.apply(labels).forEach(label => {
Expand Down

0 comments on commit aceab96

Please sign in to comment.