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

WPF: ChromiumWebBrowser as child to ScrollViewer prevent focus of HTML elements #1002

Closed
robinwassen opened this issue May 5, 2015 · 4 comments
Labels
Milestone

Comments

@robinwassen
Copy link

If you put the ChromiumWebBrowser as a child to a ScrollViewer the focus will start to misbehave.

Focus is lost if you left click a html element in the browser and it kind of works if you right click.

Steps to reproduce:

  1. Add a ScrollViewer in the XAML
  2. Add the ChromiumWebBrowser with a HTML document containing a text input as a child to the ScrollViewer
  3. Try to focus the text input by left clicking in it

Expected outcome: The text input in the HTML document should get focus.

Outcome: The text input get focus for a fraction of a second and then loses it.

Earlier mentions of this issue: CefSharp Google Groups by @vgrishin

@robinwassen robinwassen changed the title ScrollViewer prevent focus from working properly ScrollViewer prevent focus in WPF May 5, 2015
@robinwassen
Copy link
Author

Pure C# workaround:

  1. Add a event listener to MouseDown on the ChromiumWebBrowser
  2. Add e.Handled = true in the handler to prevent MouseDown from bubbling

XAML:

<cefSharp:ChromiumWebBrowser x:Name="chromiumWebBrowser" MouseDown="chromiumWebBrowser_MouseDown"  Height="800"  Address="http://www.example.com" />

C#:

void chromiumWebBrowser_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    e.Handled = true;
}

@robinwassen robinwassen changed the title ScrollViewer prevent focus in WPF WPF: ChromiumWebBrowser as child to ScrollViewer prevent focus of HTML elements May 5, 2015
@amaitland
Copy link
Member

Can you include the version your using.

@robinwassen
Copy link
Author

v39.0.1 (Stable)

@amaitland amaitland added the wpf label May 6, 2015
@john123951
Copy link

great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants