Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling IsRightTapEnabled on all UI Elements that steal focus #3349

Conversation

ryanbodrug-microsoft
Copy link
Contributor

Summary of the Pull Request

  • This PR disables the IsRightTapEnabled on all UIElements.

References

PR Checklist

  • Applies to [Launcher] Something is putting focus on the listview items. #2259
  • CLA signed. If not, go over here and sign the CLA
  • [] Tests added/passed
  • [] Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

  1. Where provided in xaml specify IsRightTapEnabled=False
  2. Override the listviewitem control template so that IsRightTapEnabled can be set to false on the ListViewItemPresenter
  3. On items with no control template such as tool tip and font icon, recurse the visual tree, and set IsRightTapEnabled to false.
  4. WHen the context button items are changing then recurse the visual tree and set IsRightTapEnabled. Note this is less efficient than overwritting the template but this is only done on selected or hovered items and there are a small number of elements in the visual tree. Alternatively we could overwrite the GridView and GridView item control templates, but this is quite verbose and error prone, for small perf impact.
    image

Validation Steps Performed

  • Click on various places around the results window. And observe either of the following are true:
  1. There is nothing in the output window. eg. Right Tap was triggered on Right Tap was triggered on Windows.UI.Xaml.Shapes.Rectangle

or

  1. Focus remains on the textbox and pressing space doesn't highlight the result. Note: The scrollbar on the right will still trigger the right click event, but doesn't steal focus.

@ryanbodrug-microsoft
Copy link
Contributor Author

ryanbodrug-microsoft commented May 20, 2020

@jyuwono / @crutkas . This is much simpler without the xaml island, and Divyansh has already made the change here. Do we still want to hotfix this or wait until .19?

Copy link
Contributor

@dsrivastavv dsrivastavv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I wasn't able to hit focus issue on right-click anymore.


private void SuggestionsList_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
{
Debug.WriteLine($"Right Tap was triggered on {e.OriginalSource}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It only writes in debug, and we can use it to identify if something being right clicked is stealing focus. Basically it should rarely print, but it if does (like on the scrollbar), then we can just verify that its not a control that will steal focus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Thanks

@ryanbodrug-microsoft ryanbodrug-microsoft merged commit c606e3d into master May 20, 2020
@crutkas crutkas deleted the user/ryanbod/issue_2259_prevent_rightclick_space_from_stealing_focus branch June 1, 2020 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants