sc/source/ui/condformat/condformatdlg.cxx |    5 +++++
 sc/source/ui/inc/condformatdlgentry.hxx   |    1 +
 2 files changed, 6 insertions(+)

New commits:
commit fbef49982f2f4943685495cfdb150c46ce5b7527
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Nov 4 19:35:47 2025 +0100
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Wed Nov 5 08:13:04 2025 +0100

    tdf#169006 sc a11y: Keep keyboard focus in conditional formatting dlg
    
    In ScCondFormatList::AfterTypeListHdl, the existing
    ScCondFrmtEntry can be deleted, and with it, its combobox
    indicating the type, and a new ScCondFrmtEntry created
    to replace it.
    
    In the case that combobox was focused (which is usually
    the case, because ScCondFormatList::AfterTypeListHdl
    is the handler that gets called when the active entry
    changes), then make sure that its combobox for the
    type takes over/receives keyboard focus, so the user
    can continue in the "same" (from their perspective)
    place.
    
    While the case of gtk3 with native GTK widgets and
    qt6 with SAL_VCL_QT_USE_WELDED_WIDGETS=1 to use native
    Qt widgets would at least allow to move the keyboard
    focus to somewhere in the dialog using the Tab key
    previously, the vcl implementation would not allow
    this, breaking keyboard accessibility of the dialog
    altogether.
    
    Change-Id: Iaa3e087cda078678d1f160ce8a49938b27e6528c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193431
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>
    (cherry picked from commit 752adf6cc9d869bbcf34fcf09c80da502398cb81)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193432
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 1b0a6195f950..8c8000c712c6 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -264,6 +264,7 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, 
void)
     if(itr == maEntries.end())
         return;
 
+    const bool bFocused = pBox->has_focus();
     sal_Int32 nPos = pBox->get_active();
     switch(nPos)
     {
@@ -314,6 +315,10 @@ IMPL_LINK(ScCondFormatList, AfterTypeListHdl, void*, p, 
void)
             break;
 
     }
+
+    if (bFocused)
+        (*itr)->GetTypeComboBox().grab_focus();
+
     Thaw();
     RecalcAll();
 }
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx 
b/sc/source/ui/inc/condformatdlgentry.hxx
index d3210b824212..afd109cedea0 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -74,6 +74,7 @@ public:
     virtual ~ScCondFrmtEntry();
 
     void Show() { mxGrid->show(); }
+    weld::ComboBox& GetTypeComboBox() { return *mxLbType; }
 
     void set_grid_top_attach(int nAttach);
     int get_preferred_height() const { return 
mxBorder->get_preferred_size().Height(); }

Reply via email to