Created attachment 149988 [details]
test file for header frame menu button key input caused misbehaviors
Here are steps which show the frame menu button pop up menu unexpectedly displayed at the top of the writer window and menu item "Insert Page Number" selection resulting in the page number inserted in the main document.
1) Open the attached file (bugtest.odt)
2) On page 1 click in the header area or use keyboard shortcut Ctrl+Page Up to move to the header edit window
3) Click on Header (Default Style) v frame menu button
4) Press Escape key to collapse the pop up menu
keyboard focus is now on the frame menu button
5) Press Page down key
document page down action happens
6) Press Space key
header frame menu button pop up menu appears at the top to the screen
7) Press Escape key
8) Press Page up key
9) Press Escape key
cursor is displayed at the end of Page 1 in the main document and Header frame menu button is still visible (you may have to move the mouse pointer over to where the frame menu button would be to have it redraw)
9) Click on Header (Default Style) v frame menu button or press the Space key
10) Select Insert Page Number
page number is inserted in main document resulting in Page 11
Created attachment 149989 [details]
video demonstration of bug report
Thank you for reporting the bug. I can confirm the bug present in
Build ID: b6b28931435e44aca92b8c0e1659f701e3ed1a87
CPU threads: 2; OS: Windows 6.1; UI render: default; VCL: win;
TinderBox: Win-x86@42, Branch:master, Time: 2019-01-30_06:57:04
Locale: en-US (en_US); UI-Language: en-US
class SwHeaderFooterWin is the header/footer frame menu button.
Declare a function override of the inherited MenuButton:KeyInput function in class SwHeaderFooterWin.
Add key input handling code to catch KEY_ESCAPE, KEY_SPACE, KEY_RETURN, and Mod2 + KEY_DOWN.
For KEY_ESCAPE grab focus to the header/footer edit window.
For KEY_SPACE, KEY_RETURN, and Mod2 + KEY_DOWN follow SwHeaderFooterWin base class hierachy to find how to execute its menu.
Search code base for KeyInput to learn about vcl::Window::KeyInput handling function
This is for the case when header/footer edit window is not empty. Currently there isn't a way that focus can be on the header/footer frame menu button when header/footer is empty but if suggested behavior change is made for Bug 124041 a check for empty/header footer edit window will be required so bonus points for implementing check here.
There is additional code required to ensure the popup menu is displayed in the correct location when executed using key input. I can supply code pointers as needed.
(In reply to Jim Raykowski from comment #3)
> There is additional code required to ensure the popup menu is displayed in
> the correct location when executed using key input.
Oops, not required here. This will be needed if suggested behavior change for Bug 124113 is implemented.
@Jim, since you provided the code pointers, can be turn this issue into an easyhack ? or you plan to work on this ?
I have some experience in resolving Header Footer bugs, would love to assign it to myself :-)