Bug 161782 - Unable to back out of many Sidebar decks into document with Esc
Summary: Unable to back out of many Sidebar decks into document with Esc
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Rafael Lima
URL: https://design.blog.documentfoundatio...
Whiteboard: target:25.2.0
Keywords: accessibility, bibisected, bisected, regression
Depends on:
Blocks: Sidebar
  Show dependency treegraph
 
Reported: 2024-06-25 16:49 UTC by Buovjaga
Modified: 2024-07-17 07:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Buovjaga 2024-06-25 16:49:54 UTC
Try this in Calc, Sidebar decks Styles, Gallery and Navigator:
1. Focus into panel
2. Hit Esc repeatedly

Result: focus remains inside the deck even though it should move to document as per Sidebar guidelines.

This regressed with 9ca60dc90958001c078ed6331bd432c36961a425
tdf#156156 Add Help button to sidebar decks

Debugging what happens when I hit Esc while in Styles, what I can see is that in the FocusManager::GetFocusLocation() function of sfx2/source/sidebar/FocusManager.cxx, the condition in the panel search loop:

if (pContents->has_child_focus())
    return FocusLocation(PC_PanelContent, nIndex);

reports has_child_focus() as being true *while I am focused in the Cell Styles button in the toolbar*! So it incorrectly reports the focus location to be PC_PanelContent. This results in a no-op for the user hitting Esc.

I suppose this has to do with the rework of sfx2/uiconfig/ui/deck.ui

To be exact, the has_child_focus() function that is called is:
SalInstanceWidget::has_child_focus at vcl/source/app/salvtables.cxx:396

That then does calls leading to Window::ImplIsChild() in vcl/source/window/stacking.cxx

I'm not sure where this should be fixed: the .ui file or FocusManager::GetFocusLocation() ?
Comment 1 Stéphane Guillou (stragu) 2024-06-26 02:13:40 UTC
Reproduced in:

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 70b3e128aef631e18e6451362c2e6315c28b857e
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded
Comment 2 Jim Raykowski 2024-06-26 05:11:28 UTC
(In reply to Buovjaga from comment #0)
> Try this in Calc, Sidebar decks Styles, Gallery and Navigator:
> 1. Focus into panel
> 2. Hit Esc repeatedly
> 
> Result: focus remains inside the deck even though it should move to document
> as per Sidebar guidelines.
> 
> This regressed with 9ca60dc90958001c078ed6331bd432c36961a425
> tdf#156156 Add Help button to sidebar decks
> 
> Debugging what happens when I hit Esc while in Styles, what I can see is
> that in the FocusManager::GetFocusLocation() function of
> sfx2/source/sidebar/FocusManager.cxx, the condition in the panel search loop:
> 
> if (pContents->has_child_focus())
>     return FocusLocation(PC_PanelContent, nIndex);
> 
> reports has_child_focus() as being true *while I am focused in the Cell
> Styles button in the toolbar*! So it incorrectly reports the focus location
> to be PC_PanelContent. This results in a no-op for the user hitting Esc.
I think the result from pContents->has_child_focus() being true is correct.

It seems to me the problem is with the PC_PanelContent handling for Esc in the FocusManager::HandleKeyEvent function:

  case PC_PanelContent:
      // Return focus to tab bar sidebar settings button or panel title.
// The deck title is not visible when sidebar is floating but maybe we shouldn't check for this and treat both floating and docked the same?
      if (!IsDeckTitleVisible() && maPanels.size() == 1)
          FocusButton(0);
// Or maybe just return to the document when there is only one panel in the deck?
      if (maPanels.size() == 1)
      {
          if (mxDeck)
              mxDeck->GrabFocusToDocument();
      }
      // more than one panel so focus on the panel title/expander 
      else
          FocusPanel(aLocation.mnIndex, true);
      bConsumed = true;
      break;
Comment 3 Jim Raykowski 2024-06-26 05:35:44 UTC
Or FocusDeckTitle() when there is only one panel in a deck. I think at one time the behavior was this.
Comment 4 Rafael Lima 2024-06-27 21:01:41 UTC
Thanks @Jim for the pointers.

This patch fixes the issue:
https://gerrit.libreoffice.org/c/core/+/169668
Comment 5 Commit Notification 2024-07-15 18:58:10 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6113d5dc45232b602bee0e68cf7560d0b8656546

tdf#161782 Focus document when Esc is pressed in the Gallery/Navigator

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Rafael Lima 2024-07-15 19:00:51 UTC
The submitted patch fixes the issue when the sidebar is docked. Pressing Esc the first time will focus the Tab bar, and pressing Esc again will focus the document.

As discussed in the patch, when the sidebar is floating, focusing the document still does not work in all VCL plugins.
Comment 7 Buovjaga 2024-07-17 07:13:24 UTC
Verified fix

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 450739e92e6f90060e5fdfa42ae291b1abaebd7a
CPU threads: 8; OS: Linux 6.9; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded