Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Bugfix/inside shadow dom #65

Merged
merged 3 commits into from
Mar 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/components/duet-date-picker/duet-date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ export class DuetDatePicker implements ComponentInterface {
return
}

const target = e.target as Node

// TODO: stopPropagation only on open??

// the dialog and the button aren't considered clicks outside.
Expand All @@ -250,11 +248,14 @@ export class DuetDatePicker implements ComponentInterface {
// and open the new one. this means we can't stopPropagation() on the button itself
//
// this was the only satisfactory combination of things to get the above to work
if (this.dialogWrapperNode.contains(target) || this.datePickerButton.contains(target)) {
return
}

this.hide(false)
const isClickOutside = e
.composedPath()
.every(node => node !== this.dialogWrapperNode && node !== this.datePickerButton)

if (isClickOutside) {
this.hide(false)
}
}

/**
Expand Down