Sha256: ffcecb34ce782b070bcb10800be7bd00d25bb5525f87a08b8bfd636a7f60831f
Contents?: true
Size: 696 Bytes
Versions: 1
Compression:
Stored size: 696 Bytes
Contents
import { Controller } from "@hotwired/stimulus" export default class extends Controller { static targets = [ "item" ] static values = { index: Number } indexValueChanged() { this.#removeTabstops() this.#focusCurrentItem() } prev() { this.indexValue > 0 && this.indexValue-- } next() { this.indexValue < this.#lastIndex && this.indexValue++ } reset() { this.indexValue = 0 } #removeTabstops() { this.itemTargets.forEach(item => item.tabIndex = -1) } #focusCurrentItem() { this.itemTargets[this.indexValue].tabIndex = 0 this.itemTargets[this.indexValue].focus() } get #lastIndex() { return this.itemTargets.length -1 } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
css-zero-0.0.45 | lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js |