This commit fixes a bug where it was possible to select multiple radio
buttons from one RadioButtonGroup in accessibility (screen reader) mode.
OnAccessibilityActivated() contained code copied from OnKey(). However,
some classes derived from Button override OnKey(), e.g. SelectButton
makes sure that other buttons in the group are unselected if necessary.
Rather than overriding OnAccessibilityActivated() in derived classes, it
is better to invoke OnKey() instead, in order to reduce code
duplication.
Note: this change matches the corresponding logic in DALi Toolkit, where
OnAccessibilityActivated() is implemented in terms of OnKeyboardEnter().
Co-authored-by: Artur Świgoń <a.swigon@samsung.com>
internal override bool OnAccessibilityActivated()
{
internal override bool OnAccessibilityActivated()
{
+ using (var key = new Key())
+ key.State = Key.StateType.Down;
+ key.KeyPressedName = "Return";
- // Touch Down
- isPressed = true;
- UpdateState();
+ // Touch Down
+ OnKey(key);
- // Touch Up
- bool clicked = isPressed && IsEnabled;
- isPressed = false;
-
- if (IsSelectable)
- {
- IsSelected = !IsSelected;
- }
- else
- {
- UpdateState();
+ // Touch Up
+ key.State = Key.StateType.Up;
+ OnKey(key);
- if (clicked)
- {
- ClickedEventArgs eventArgs = new ClickedEventArgs();
- OnClickedInternal(eventArgs);
- }