Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

315 B
Raw Blame
// From https://alpinejs.dev/component/dropdown

export default () => ({
  open: false,
  toggle() {
    if (this.open) {
      return this.close()
    }

    this.$refs.button.focus()
    this.open = true
  },

  close(focusAfter) {
    if (!this.open) return

    this.open = false
    focusAfter?.focus()
  }
})