Component::keyPressed issue ( Duplicated event in Ableton, Event is not consumed even with "return true" in Studio One)

I have the following issues regarding ‘keyPressed.’ Does anyone know the reason? Are these issues on the DAW side or the JUCE side?

Following changes to the empty Plugin project generated by Projucer 7.0.7.

class NewProjectAudioProcessorEditor  : public juce::AudioProcessorEditor
    NewProjectAudioProcessorEditor (NewProjectAudioProcessor&);
    ~NewProjectAudioProcessorEditor() override;

    void paint (juce::Graphics&) override;
    void resized() override;

    // --- Added from here
    virtual bool keyPressed(const juce::KeyPress& key) override {
        if (key.getKeyCode() == 65) {
            DBG("A received");
            return true;
        return false;
    // ----- to here

    // This reference is provided as a quick way for your editor to
    // access the processor object that created it.
    NewProjectAudioProcessor& audioProcessor;


Set setWantKeyboardFocus(true) in editor constructor.

NewProjectAudioProcessorEditor::NewProjectAudioProcessorEditor (NewProjectAudioProcessor& p)
    : AudioProcessorEditor (&p), audioProcessor (p)
    // Make sure that before the constructor has finished, you've set the
    // editor's size to whatever you need it to be.
    setWantsKeyboardFocus(true);  // Added
    setSize (400, 300);

Issue 1 Duplicated key press event in Ableton

  • Environment : Windows 11 x64, Ableton Live 11.3.4
  • Load vst3 plugin in DAW, in the plugin window press ‘a’ key once, then we receive 2 ‘a’ key events in the plugin

Issue 2 Key press is not consumed with “return true” in Studio One

  • Environment : Windows 11 x64, Studio One 6.1.1
  • Load vst3 plugin in DAW, in the plugin window press ‘a’ key once, then we receive 1 ‘a’ key events in the plugin However, DAW also receive a key event and the function associated with key ‘a’ is triggered( by defualt Studio One swtich the automation view by key ‘a’)

Looking at a similar issue here. I think we have to use keyStateChanged() and detect the down and up changes to the keys we’re interested in. Haven’t made that change in my code to test with yet, though.

Thank you for infomration. I’ll try it.

We’ve made some changes to Windows plugin keyboard handling recently:

Please try updating and check whether the issue is still present on the develop branch.

Hi reuk,

Thank you for the information.
I confimred the issues are solved with that commit in develop branch. ( and confimred in released 7.0.8 as well).

Thank you !