HubSpot / vex

A modern dialog library which is highly configurable and easy to style. #hubspot-open-source
http://github.hubspot.com/vex/docs/welcome
MIT License
6.92k stars 491 forks source link

'popstate' event closes window #212

Closed ghost closed 7 years ago

ghost commented 7 years ago

In vex.combined.js, vex.closeAll is added as listener to the popstate event:

// Close all vexes on history pop state (useful in single page apps)
window.addEventListener('popstate', vex.closeAll)

Thus, e.g. going back in history, thus activating the popstate event, runs vex.closeAll which is defined as follows:

  // Close every vex!
  closeAll: function closeAll () {
    for (var id in vexes) {
      this.close(id)
    }
    return true
  },

In this particular call of close, this is window. Thus, going back in history, may close the window.

ghost commented 7 years ago

I created a merge request: #213. Please merge. Should I bump the version number?

ghost commented 7 years ago

Nevermind, is still an issue in the lastest release (3.0.0) but it's fixed in master branch.