BR: Sliders don't work with Voice Over

If I use Voice Over to change the value of a slider, the value of the slider is updated, but sliderValueChanged (Slider *slider) is never called. So the slider is updating on the screen, but nothing connected to it ever updates.

I do not think this is correct:

void setValue (double newValue) override { valueToControl = newValue; }

It should be:

void setValue (double newValue) override                 
{ 
            DragInProgress drag (slider);
            setValue (newValue, sendNotificationSync);
}

But that requires access to the pimpl, which the accessibility handler doesn’t have. The Slider needs to expose a way to send the drag start and stop messages, otherwise there is no way to properly implement keyboard handling for the Slider.

Thanks for reporting, this should be fixed on develop now:

Thank you, but please consider a way of doing this without pimpl access or this no way for end users to write an AccessibilityHandler for Sliders.

Something like this perhaps: https://github.com/reFX/JUCE/commit/a13e1bc256933c7fdd5d9902b9db00e1fae26b11

I’ve added this to the develop branch here:

1 Like

We’re getting occasional crashes with this change during the Slider destructor. It looks like the pimpl has has already been deleted in these cases and is nullptr. This change seems to resolve it for us:

...
Slider::ScopedDragNotification::ScopedDragNotification (Slider& s)
    : sliderBeingDragged (s)
{
    sliderBeingDragged.pimpl->sendDragStart();
}

Slider::ScopedDragNotification::~ScopedDragNotification()
{
    if (sliderBeingDragged.pimpl != nullptr)
        sliderBeingDragged.pimpl->sendDragEnd();
}
...

Stack trace BTW was…

JUCE Message Thread (1) Queue : com.apple.main-thread (serial)
#0	0x0000000109849540 in juce::Slider::Pimpl::sendDragEnd()                                                                                                                                             
#1	0x0000000109849519 in juce::Slider::ScopedDragNotification::~ScopedDragNotification()                                                                                                                
#2	0x0000000109849665 in juce::Slider::ScopedDragNotification::~ScopedDragNotification()                                                                                                                
#3	0x00000001098f7ccb in std::__1::default_delete<juce::Slider::ScopedDragNotification>::operator()(juce::Slider::ScopedDragNotification*) const                                                        
#4	0x00000001098f7c4f in std::__1::unique_ptr<juce::Slider::ScopedDragNotification, std::__1::default_delete<juce::Slider::ScopedDragNotification> >::reset(juce::Slider::ScopedDragNotification*)      
#5	0x00000001098f7be9 in std::__1::unique_ptr<juce::Slider::ScopedDragNotification, std::__1::default_delete<juce::Slider::ScopedDragNotification> >::~unique_ptr()                                     
#6	0x00000001098f7b05 in std::__1::unique_ptr<juce::Slider::ScopedDragNotification, std::__1::default_delete<juce::Slider::ScopedDragNotification> >::~unique_ptr()                                     
#7	0x00000001098f78e0 in juce::Slider::Pimpl::~Pimpl()                                                                                                                                                  

Thanks Martin! I’ll get that fixed.

1 Like