Skip to content

Commit

Permalink
Don't cycle objects with tab key if canvas has focus
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Dec 4, 2023
1 parent b066d16 commit c1626f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Source/Objects/ObjectImplementations.h
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,6 @@ class KeycodeObject final : public ImplementationBase
#if !JUCE_IOS
void update() override
{


auto* canvas = getMainCanvas(cnv, true);
if (canvas) {
attachedEditor = canvas->editor;
Expand Down
5 changes: 4 additions & 1 deletion Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,10 @@ void PluginEditor::enablePluginMode(Canvas* cnv)
// it would be annoying to hear the bloop sound for every key that isn't a valid command
bool PluginEditor::keyPressed(KeyPress const& key)
{
return key.getKeyCode() != KeyPress::tabKey;
// Claim tab keys on canvas to prevent cycling selection
// The user might want to catch the tab key with an object, this behaviour just gets in the way
// We do still want to allow tab cycling on other components, so if canvas doesn't have focus, don't grab the tab key
return getCurrentCanvas()->hasKeyboardFocus(true) || key.getKeyCode() != KeyPress::tabKey;
}

void PluginEditor::commandKeyChanged(bool isHeld)
Expand Down

0 comments on commit c1626f1

Please sign in to comment.