Current filter:
                                You should refresh the page.
                                0
                                  • When the 'alt' key is used to set focus to the ribbon bar and activate keyboard tips, and the user subsequently presses 'escape', the ribbon restores focus to the control that was active before the ribbon took focus.

                                    However, when the previously active control is contained within a UserControl (or, form what I can tell, any control that implements IContainerControl), focus is restored to the user control and not to the previously focused control.

                                    A possible explanation for this behaviour is that the ribbon is querying Form.ActiveForm.ActiveControl to determine the active control before taking focus and is not recursing into the ActiveControl if the active control implements IContainerControl.

                                    Steps to Reproduce:

                                    Run the attached project. You will see two text boxes; the first is contained within an instance of 'System.Windows.Forms.UserControl', the second within an instance of 'System.Windows.Forms.Control'.

                                    1.> Give the first text box focus

                                    2.> Press and release 'Alt' - note that the ribbon now has input focus and the key tips are displayed.

                                    3.> Press and release 'Escape' - note that the ribbon loses focus but that focus is not restored to the text box.

                                    4.> Give the second text box focus

                                    5.> Press and release 'Alt' - note that the ribbon now has input focus and the key tips are displayed.

                                    6.> Press and release 'Escape' - note that focus is restored to the text box.

                                    Actual Results:

                                    When escape is used to cancel a keyboard operation on the Ribbon bar, focus appears to be restored only to the prior value of Form.ActiveForm.ActiveControl and not to the previously focused control.

                                    Expected Results:

                                    When escape is used to cancel a keyboard operation on the Ribbon bar, focus should always be restored to the control that has focus before the operation was initiated.

                                    Note in the sample application that when a character is typed into one of the text boxes, the value of Form.ActiveForm.ActiveControl.Name is written to the debug output - this should help to see the problem.

                                Sample.zip
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.