Skip to content

Commit

Permalink
Show dropzone when dragover page and not input
Browse files Browse the repository at this point in the history
  • Loading branch information
querkmachine committed Oct 24, 2024
1 parent 33891bc commit 16960ef
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ export class FileUpload extends GOVUKFrontendComponent {

// Bind change event to the underlying input
this.$root.addEventListener('change', this.onChange.bind(this))
this.$wrapper.addEventListener('dragover', this.onDragOver.bind(this))
this.$wrapper.addEventListener(
'dragleave',
this.onDragLeaveOrDrop.bind(this)
)

// When a file is dropped on the input
this.$wrapper.addEventListener('drop', this.onDragLeaveOrDrop.bind(this))

// When a file is dragged over the page (or dragged off the page)
document.addEventListener('dragover', this.onDragOver.bind(this))
document.addEventListener('dragleave', this.onDragLeaveOrDrop.bind(this))
}

/**
Expand Down

0 comments on commit 16960ef

Please sign in to comment.