Skip to content

Commit

Permalink
Close youtube modal keyboard close controls.
Browse files Browse the repository at this point in the history
  • Loading branch information
uxder committed Jan 28, 2021
1 parent 8387004 commit babea5c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions youtubemodal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ function YouTubeModal(config) {
e.preventDefault(); // Prevent "space" from scrolling the page.
this.play(videoId, true /* opt_updateState */, startTime, attribution);
}

var closeClass = this.config.className + '-x';
var closeAttribute = 'data-' + this.config.className + '-x';
if (targetEl.classList.contains(closeClass)
|| targetEl.hasAttribute(closeAttribute)) {
this.setActive_(false);
}
}.bind(this);

// Loads YouTube iframe API.
Expand Down

0 comments on commit babea5c

Please sign in to comment.