Unwanted Keyboard focus on Component inside table

Hey guys, a bit of a specific issue here, I hope you can help me.

I went and modified JUCE’s Table Demo to reproduce the issue (JUCE\examples\Demo\Source\Demos\WidgetsDemo.cpp). Only mofidication was to use TextEditor components for the “Artist” column, in addition to the existing editable labels and ComboBoxes.

My issue is that whenever a row is selected by clicking on the cell in the “ID” column, the TextEdit component in the “Artist” column gets the keyboard focus. I don’t want that.

My desired behaviour would be to only gain focus when the user clicks on or tabs onto the actual TextEdit, and only then. Funnily enough, if I select the row by clicking on any other column, the TextEdit does not get keyboard focus.

I know this sounds like a very minor problem, but due to other circumstances in my Plugin, this is causing a lot of headaches.

Any ideas?

To give a bit more detailed info, I added the following nested class to TableDemoComponent:

class SongColumnCustomComponent : public Component
	SongColumnCustomComponent(TableDemoComponent& td) : owner(td)
		// just put a TextEditor inside this component

		m_textEditor.onTextChange = [this] { owner.setText(columnId, row, m_textEditor.getText()); };

	void resized() override

	// Our demo code will call this when we may need to update our contents
	void setRowAndColumn(int newRow, int newColumn)
		row = newRow;
		columnId = newColumn;
		m_textEditor.setText(owner.getText(columnId, row), dontSendNotification);

	TableDemoComponent& owner;
	TextEditor m_textEditor;
	int row, columnId;

And then in refreshComponentForCell(…) I added:

	if (columnId == 2) // Artist name column.
		SongColumnCustomComponent* textEditor = static_cast<SongColumnCustomComponent*> (existingComponentToUpdate);

		// If an existing component is being passed-in for updating, we'll re-use it, but
		// if not, we'll have to create one.
		if (textEditor == nullptr)
			textEditor = new SongColumnCustomComponent(*this);

		textEditor->setRowAndColumn(rowNumber, columnId);
		return textEditor;

Other than that it’s identical to the original WidgetsDemo.cpp.