summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-11-02 13:28:22 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-02 15:54:24 +0100
commit97c9b0ccedeecf37c565adffb9f3823558013848 (patch)
tree8b69badd9ce830da288a7774dcf136929b2a1d20 /accessibility
parent96ed0b0c15cf9bacd28a0dcfdb6d109e86e5c998 (diff)
tdf#112661 tdf#112662 a11y: Fix toggling button via a11y action
`PushButton::Click does not` toggle a `PushButton` that is a toggle button. Therefore, call `PushButton::Check` and `PushButton::Toggle` instead when the acessible "press" action is performed on a toggle button, which makes this work as expected. The same is already done in the UITest code, see `ButtonUIObject::execute`. The originally rerported issue in tdf#112661 and tdf#112662 was that there was no action available for the "Templates" and "Recent Documents" toggle buttons in the start center via the NSAccessibility API on macOS at all. By now, the "press" action was available, but performing the action (e.g. using the Ctrl+CapsLock+Space keyboard shortcut for VoiceOver) didn't have any effect. The same was true when performing the action via Accerciser using the AT-SPI Action interface when using the qt6 VCL plugin on Linux. With this change in place, toggling between showing the templates and the recently used documents in the start center works using that action, just as it does when clicking on one of the toggle buttons in the UI using the mouse. For gtk3, which is using native GtkToggleButtons, this was already working without this change in place. Change-Id: Ie3f02ec914239e0718ca1bfb4ba701f0831bb16a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158807 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 52153a0c22b9..31c8188b99ab 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -167,7 +167,18 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex )
VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
- pButton->Click();
+ {
+ if (pButton->isToggleButton())
+ {
+ // PushButton::Click doesn't toggle when it's a toggle button
+ pButton->Check(!pButton->IsChecked());
+ pButton->Toggle();
+ }
+ else
+ {
+ pButton->Click();
+ }
+ }
return true;
}