Sha256: ce317c96d391f21230bc77f819af01796ba4724a54ea2031113faefc72e1e9cc
Contents?: true
Size: 750 Bytes
Versions: 22
Compression:
Stored size: 750 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.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
22 entries across 22 versions & 1 rubygems