Skip to content

Commit

Permalink
fix: #date-picker "outside click" on touch devices
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jun 3, 2019
1 parent ac31413 commit 1dc3297
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/dnb-ui-lib/src/components/date-picker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export default class DatePicker extends PureComponent {
}
}
document.addEventListener('mousedown', this.handleClickOutside)
document.addEventListener('touchstart', this.handleClickOutside)

this.keydownCallback = event => {
const keyCode = keycode(event)
Expand Down Expand Up @@ -325,6 +326,7 @@ export default class DatePicker extends PureComponent {
removeOutsideClickHandler() {
if (this.handleClickOutside && typeof document !== 'undefined') {
document.removeEventListener('mousedown', this.handleClickOutside)
document.removeEventListener('touchstart', this.handleClickOutside)
this.handleClickOutside = null
}
if (this.keydownCallback) {
Expand Down

0 comments on commit 1dc3297

Please sign in to comment.