Skip to content

Commit

Permalink
fix: add touch event for modal screen (#292)
Browse files Browse the repository at this point in the history
This PR introduces the touchend event so that clicking the screen of a modal will close it.
  • Loading branch information
sebnitu committed Aug 7, 2020
1 parent f2557b2 commit d8a4433
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/dist/scripts.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ var Drawer = function Drawer(options) {
setTabindex();
api.breakpoint.init();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

Expand All @@ -877,6 +878,7 @@ var Drawer = function Drawer(options) {
api.state = {};
localStorage.removeItem(api.settings.stateKey);
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down Expand Up @@ -1428,12 +1430,14 @@ var Modal = function Modal(options) {
setTabindex();
moveModals();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

api.destroy = function () {
api.memory = {};
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
4 changes: 4 additions & 0 deletions docs/dist/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@
setTabindex();
api.breakpoint.init();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

Expand All @@ -878,6 +879,7 @@
api.state = {};
localStorage.removeItem(api.settings.stateKey);
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down Expand Up @@ -1429,12 +1431,14 @@
setTabindex();
moveModals();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

api.destroy = function () {
api.memory = {};
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
4 changes: 2 additions & 2 deletions docs/dist/scripts.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/drawer/dist/scripts.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ var Drawer = function Drawer(options) {
setTabindex();
api.breakpoint.init();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

Expand All @@ -763,6 +764,7 @@ var Drawer = function Drawer(options) {
api.state = {};
localStorage.removeItem(api.settings.stateKey);
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
2 changes: 2 additions & 0 deletions packages/drawer/dist/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@
setTabindex();
api.breakpoint.init();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

Expand All @@ -762,6 +763,7 @@
api.state = {};
localStorage.removeItem(api.settings.stateKey);
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/dist/scripts.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/drawer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const Drawer = (options) => {
setTabindex();
api.breakpoint.init();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

Expand All @@ -63,6 +64,7 @@ export const Drawer = (options) => {
api.state = {};
localStorage.removeItem(api.settings.stateKey);
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
2 changes: 2 additions & 0 deletions packages/modal/dist/scripts.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,14 @@ var Modal = function Modal(options) {
setTabindex();
moveModals();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

api.destroy = function () {
api.memory = {};
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down
2 changes: 2 additions & 0 deletions packages/modal/dist/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,14 @@
setTabindex();
moveModals();
document.addEventListener('click', handler, false);
document.addEventListener('touchend', handler, false);
document.addEventListener('keyup', handlerEscape, false);
};

api.destroy = function () {
api.memory = {};
document.removeEventListener('click', handler, false);
document.removeEventListener('touchend', handler, false);
document.removeEventListener('keyup', handlerEscape, false);
};

Expand Down

0 comments on commit d8a4433

Please sign in to comment.