stimulus-shortcut
stimulus-shortcut copied to clipboard
Unable to run the example
Hello, I haven't been able to run this example. I have been able to run stimulus-hotkeys
without issue. This is what my controllers/index.js
looks like.
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { Application } from "stimulus"
import Shortcut from 'stimulus-shortcut'
import Hotkeys from 'stimulus-hotkeys'
import { definitionsFromContext } from "stimulus/webpack-helpers"
const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))
application.register('shortcut', Shortcut)
application.register('hotkeys', Hotkeys)
And on a view template:
<a href="my_route" data-controller="shortcut" data-shortcut-key-value="p">Type 'p' to activate me!</a>
I am using Rails 6.0.3 and Stimulus 2 (the preview before, and just updated it to the new release without anything changing.
Am I missing something? Thanks in advance!
same issue
Same for me, did anyone manage to solve it? @Amval @MohamedTaha123 ? Thanks
Still not working. I checked with a brand-new project, and this project is broken (at least with how you're told to use it.)
I used the stimulus-starter project from the Stimulus handbook to create this Glitch project. Then I followed the instructions in the README exactly, and it's not working. You can check out that glitch project to see if I did anything wrong. Hitting the letter "p" should submit the form, and you should see a console log, but there's nothing.