Skip to content

Commit 9e50119

Browse files
committed
Couple of a11y fixes for the IR load menu.
1 parent d390e70 commit 9e50119

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/surge-xt/gui/widgets/CurrentFxDisplay.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ struct ConvolutionButton : public juce::Component
4141
SurgeGUIEditor *sge{nullptr};
4242
void setSurgeGUIEditor(SurgeGUIEditor *s) { sge = s; }
4343

44+
CurrentFxDisplay *cfxd{nullptr};
45+
void setCurrentFxDisplay(CurrentFxDisplay *p) { cfxd = p; }
46+
4447
ConvolutionEffect *fx{nullptr};
4548
FxStorage *fxs{nullptr};
4649
int slot{-1};
@@ -388,6 +391,10 @@ struct ConvolutionButton : public juce::Component
388391
}
389392
sge->synth->fx_reload[slot] = true;
390393
sge->synth->load_fx_needed = true;
394+
395+
if (cfxd)
396+
cfxd->had_focus = true;
397+
391398
return true;
392399
}
393400
};
@@ -398,6 +405,7 @@ CurrentFxDisplay::CurrentFxDisplay(SurgeGUIEditor *e)
398405
{
399406
editor_ = e;
400407
storage = e->getStorage();
408+
had_focus = false;
401409
}
402410

403411
CurrentFxDisplay::~CurrentFxDisplay() {}
@@ -587,6 +595,7 @@ void CurrentFxDisplay::convolutionLayout()
587595
// button->setWantsKeyboardFocus(true);
588596
button->setStorage(storage);
589597
button->setSurgeGUIEditor(editor_);
598+
button->setCurrentFxDisplay(this);
590599
button->setEffect(&fx, &storage->getPatch().fx[current_fx_], current_fx_);
591600
button->setBounds(vr);
592601
auto ol = std::make_unique<OverlayAsAccessibleButton<ConvolutionButton>>(
@@ -601,6 +610,7 @@ void CurrentFxDisplay::convolutionLayout()
601610
}
602611
ol->setTitle(irname);
603612
ol->setDescription(irname);
613+
ol->setHelpText("Impulse Response Loader Menu");
604614

605615
ol->onPress = [this](ConvolutionButton *c) { c->showIRMenu(); };
606616
ol->onMenuKey = [this](ConvolutionButton *c) {
@@ -611,6 +621,12 @@ void CurrentFxDisplay::convolutionLayout()
611621
menu = std::move(ol);
612622
menu->setBounds(vr);
613623
editor_->addAndMakeVisibleWithTracking(this, *menu);
624+
625+
if (had_focus)
626+
{
627+
menu->grabKeyboardFocus();
628+
had_focus = false;
629+
}
614630
}
615631

616632
void CurrentFxDisplay::conditionerRender()

src/surge-xt/gui/widgets/CurrentFxDisplay.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ class CurrentFxDisplay : public MainFrame::OverlayComponent
5353
std::unordered_map<std::string, std::string> uiidToSliderLabel;
5454
SurgeStorage *storage{nullptr};
5555

56+
// Okay, this one is a bit weird. We trigger off an FX reload with some
57+
// operations (loading a new IR). When this happens, the original FX layout
58+
// gets redone and we go through a new FX layout. Focus gets wiped if that
59+
// happens, so we have to remind ourselves to refocus on where it had it
60+
// last once we redo the layout.
61+
bool had_focus;
62+
5663
private:
5764
// Individual FX layouts.
5865
void defaultLayout();

0 commit comments

Comments
 (0)