Skip to content

Instantly share code, notes, and snippets.

@KimSarabia
Last active January 24, 2020 18:55
Show Gist options
  • Save KimSarabia/61159f3fc1bd2a5674ceec70b249f151 to your computer and use it in GitHub Desktop.
Save KimSarabia/61159f3fc1bd2a5674ceec70b249f151 to your computer and use it in GitHub Desktop.
Event emitter so focus goes back to modal trigger on close (MJS-4011)
// Sample of opening the cart via componentEvents.emitEvent.
// NOTE: openerElement needs to be populated with an actual DOM Node
// or jQuery object and not just a selector.
// In this instance, test is the trigger element with the ID flyout-test.
const test = document.getElementById('flyout-test')
// Event emitter
componentEvents.emitEvent('open-cart-flyout', [{
openerElement: test
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment