Sha256: 73f20f4933ccd1c2e0b9a92a85e4ca4285190147530f62433f89cc85de484414
Contents?: true
Size: 761 Bytes
Versions: 5
Compression:
Stored size: 761 Bytes
Contents
import { CocoComponent } from "@js/coco"; export default CocoComponent("modalDialog", () => { return { frame: null, init() { this.onFrameLoad = this.onFrameLoad.bind(this); this.frame = this.$el.closest("turbo-frame"); if (this.frame) { this.frame.addEventListener("turbo:frame-load", this.onFrameLoad); } }, close() { this.$dispatch("modal:hide"); }, onFrameLoad() { this.$focus.focus(this.firstInput); }, destroy() { if (this.frame) { this.frame.removeEventListener("turbo:frame-load", this.onFrameLoad); } }, get firstInput() { return this.$root.querySelector( "input:not([type=hidden]), textarea, select" ); }, }; });
Version data entries
5 entries across 5 versions & 1 rubygems