Skip to content

Commit

Permalink
Merge pull request #141 from loftwah/dl/dropdown-controller-fix
Browse files Browse the repository at this point in the history
remove debugging
  • Loading branch information
loftwah authored Sep 14, 2024
2 parents 9076c14 + 98768de commit c1b7a8e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions app/javascript/controllers/dropdown_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@ import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "menu" ]

connect() {
console.log("Dropdown controller connected", this.element)
console.log("Menu target:", this.menuTarget)
}

toggle() {
console.log("Toggle called")
if (this.hasMenuTarget) {
console.log("Menu target found, toggling visibility")
this.menuTarget.classList.toggle('hidden')
} else {
console.error("Menu target not found")
}
}

hide(event) {
if (!this.element.contains(event.target)) {
console.log("Hiding dropdown")
this.menuTarget.classList.add('hidden')
}
}
}
}

0 comments on commit c1b7a8e

Please sign in to comment.