cui/source/tabpages/border.cxx | 2 +- include/svx/frmsel.hxx | 2 +- svx/source/dialog/frmsel.cxx | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-)
New commits: commit bec0b0c3d7510d979b50b013b2025afeb2df158e Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jul 3 13:57:47 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jul 4 06:36:42 2025 +0200 tdf#167279 svx FrameSelector a11y: Don't send focus events when only selecting In the borders tabpage used in Writer's "Borders" tab of the "Format" -> "Paragraphs" dialog, don't always send AccessibleStateType::FOCUSED events for a border when it is selected. Only do so when it also receives focus, not otherwise. Add a bool param to FrameSelector::SelectBorder to indicate whether or not the event should be sent. For the case of clicking one of the options in the "Presets" section handled in SvxBorderTabPage::SelPreHdl_Impl, focus remains on the selected item there, so don't send a focus event. This prevents misleading screen readers about what widget/object is actually focused. The logic in SelPreHdl_Impl was more or less there already, just commented out... Change-Id: If2258649528824702e3bf1859f4f0e8638ca9fb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187327 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index eba8bdc23fe4..781fecdb4d14 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1195,7 +1195,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, ValueSet*, void) svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder ); switch( ppeStates[ nLine ][ nBorder ] ) { - case SHOW: m_aFrameSel.SelectBorder( eBorder ); break; + case SHOW: m_aFrameSel.SelectBorder(eBorder, false); break; case HIDE: /* nothing to do */ break; case DONT: m_aFrameSel.SetBorderDontCare( eBorder ); break; } diff --git a/include/svx/frmsel.hxx b/include/svx/frmsel.hxx index 1778942fb7d0..95ceb25b4bb2 100644 --- a/include/svx/frmsel.hxx +++ b/include/svx/frmsel.hxx @@ -137,7 +137,7 @@ public: /** Returns true, if the specified frame border is selected. */ bool IsBorderSelected( FrameBorderType eBorder ) const; /** Selects or deselects the specified frame border. */ - void SelectBorder( FrameBorderType eBorder ); + void SelectBorder(FrameBorderType eBorder, bool bFocus); /** Returns true, if any of the enabled frame borders is selected. */ bool IsAnyBorderSelected() const; /** Selects or deselects all frame borders. */ diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 4a7cdf7ea012..29f0e6b5b8de 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -983,11 +983,11 @@ bool FrameSelector::IsBorderSelected( FrameBorderType eBorder ) const return mxImpl->GetBorder( eBorder ).IsSelected(); } -void FrameSelector::SelectBorder( FrameBorderType eBorder ) +void FrameSelector::SelectBorder(FrameBorderType eBorder, bool bFocus) { mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), true/*bSelect*/ ); #if !ENABLE_WASM_STRIP_ACCESSIBILITY - // if (bFocus) + if (bFocus) { rtl::Reference< a11y::AccFrameSelectorChild > xRet = GetChildAccessible(eBorder); if (xRet.is()) @@ -1146,8 +1146,7 @@ bool FrameSelector::MouseButtonDown( const MouseEvent& rMEvt ) if (!pBorder->IsSelected()) { bNewSelected = true; - //mxImpl->SelectBorder( **aIt, true ); - SelectBorder(pBorder->GetType()); + SelectBorder(pBorder->GetType(), true); } } else @@ -1228,7 +1227,7 @@ bool FrameSelector::KeyInput( const KeyEvent& rKEvt ) if( eBorder != FrameBorderType::NONE ) { DeselectAllBorders(); - SelectBorder( eBorder ); + SelectBorder(eBorder, true); } bHandled = true; } @@ -1267,7 +1266,7 @@ void FrameSelector::GetFocus() borderType = FrameBorderType::TLBR; else if (mxImpl->maBLTR.IsSelected()) borderType = FrameBorderType::BLTR; - SelectBorder(borderType); + SelectBorder(borderType, true); } for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt ) mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
