Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for GH-1247 for Edge (click outside does not close menu) #130

Merged
merged 1 commit into from Jul 11, 2018
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -51,6 +51,24 @@ class ClickOutside extends React.Component {
* @param {Object} e mouseclick event
*/
clickHandler(e) {
// Simple polyfill for Event.composedPath
// Edge does not support path or composedPath
if (!('composedPath' in Event.prototype)) {
Event.prototype.composedPath = function () {
const path = [];
let el = this.target;
while (el) {
path.push(el);
if (el.tagName === 'HTML') {
path.push(document);
path.push(window);
break;
}
el = el.parentElement;
}
return path;
};
}
const el = this.container;
const ePath = e.path || (e.composedPath && e.composedPath());
if (
ProTip! Use n and p to navigate between commits in a pull request.