Skip to content

Commit

Permalink
GurmukhiKeyboard fix (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogas04 authored Jan 24, 2019
1 parent ed95f74 commit 5c3782f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sttm/web",
"version": "1.1.10",
"version": "1.1.11",
"description": "Sevadaars are currently working hard to build a newer version of SikhiToTheMax website using modern web technologies.",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 11 additions & 3 deletions src/js/components/GurmukhiKeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ export default class GurmukhiKeyboard extends React.PureComponent {
};

componentDidMount() {
addEventListener('click', this.windowEventListener);
addEventListener('click', this.closeOnOutsideClick);
}

windowEventListener = ({ path = [] }) => {
closeOnOutsideClick = e => {
const path =
typeof e.composedPath === 'function' ? e.composedPath() : e.path || [];

// If path is empty, let's assume browser doesn't support it and don't do anything.
if (path.length === 0) {
return;
}

if (
path.some(
({ classList = null }) =>
Expand All @@ -71,7 +79,7 @@ export default class GurmukhiKeyboard extends React.PureComponent {
};

componentWillUnmount() {
removeEventListener('click', this.windowEventListener);
removeEventListener('click', this.closeOnOutsideClick);
}

render() {
Expand Down

0 comments on commit 5c3782f

Please sign in to comment.