Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: [OSX, standalone] It is not possible to edit a TextEditor shown inside a PopupMenu::CustomComponent

Open
#1,651 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
desktop

Research direction

Reproduce the provided example in a Projucer GUI template on macOS as a standalone app with JUCE 8.0.12. Start by examining how PopupMenu::CustomComponent and TextEditor handle keyboard input, comparing the standalone behavior with the working plugin and other platforms. Done means the TextEditor inside the popup accepts keyboard input and its value can be edited.

Written by the indexing model from the issue text.

Description

Detailed steps on how to reproduce the bug

When compiled as a standalone app on OSX with juce 8.0.12, TextEditor set inside a PopupMenu::CustomComponent are not editable. On linux and windows and even on OSX as a plugin it works but standalone its impossible to edit the text.

By using a subclass of TextEditor and some other code to make sure that the PopupMenu doesn't close too fast, I'm able to see that clicks are registered, the location of the caret changes but keyPressed is never called. onReturnKey is never called either.

Here is some code to reproduce the issue. I have reproduced it with a projucer GUI template and the following code:

Custom popupmenu h file:

#pragma once

#include <JuceHeader.h>

class PopupTextEditor
    : public juce::PopupMenu::CustomComponent
{
public:
    void getIdealSize(int & idealWidth, int & idealHeight) override;
    void initPopupTextEditor(std::unique_ptr<juce::TextEditor> textEditor);
private:
    std::unique_ptr<juce::TextEditor> mPopupTextEditor;
    JUCE_LEAK_DETECTOR(PopupTextEditor)
};

custom popupmenu cpp file:

#include "cg_PopupTextEditor.h"

//==============================================================================
void PopupTextEditor::getIdealSize(int & idealWidth, int & idealHeight)
{
    idealWidth = mPopupTextEditor->getWidth();
    idealHeight = mPopupTextEditor->getHeight();
}

//==============================================================================
void PopupTextEditor::initPopupTextEditor(std::unique_ptr<juce::TextEditor> textEditor)
{
    mPopupTextEditor = std::move(textEditor);
    addAndMakeVisible(*mPopupTextEditor);
}

main component h file

#pragma once

#include <JuceHeader.h>
#include <memory>
class MainComponent  : public juce::Component
{
public:
    //==============================================================================
    MainComponent();
    ~MainComponent() override;
    //==============================================================================
    void paint (juce::Graphics&) override;
    void resized() override;
    juce::PopupMenu pop;
private:
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};

main component cpp file

#include "MainComponent.h"
#include "cg_PopupTextEditor.h"

//==============================================================================
MainComponent::MainComponent()
{
    setSize (600, 400);
    auto edit = std::make_unique<juce::TextEditor>("text editor");
    edit->setSize(60, 20);
    edit->setText("3434");
    edit->selectAll();
    auto popup{std::make_unique<PopupTextEditor>()};
    popup->initPopupTextEditor(std::move(edit));
    pop.clear();
    pop.addCustomItem(1, std::move(popup), nullptr, "text editor");
    pop.showMenuAsync(juce::PopupMenu::Options(), [](int res){});
}

MainComponent::~MainComponent()
{
}

//==============================================================================
void MainComponent::paint (juce::Graphics& g)
{
}

void MainComponent::resized()
{
}
What is the expected behaviour?

The value of the texteditor should be editable with the keyboard

Operating systems

macOS

What versions of the operating systems?

Tahoe 26.2

Architectures

Arm64/aarch64

Stacktrace

Plug-in formats (if applicable)

Standalone

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

I have not tested against the develop branch

Code of Conduct
  • I agree to follow the Code of Conduct
Dominant language
C++
Stars
8.9k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from juce-framework/JUCE

All issues in juce-framework/JUCE

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.