CefSharp icon indicating copy to clipboard operation
CefSharp copied to clipboard

WPF - Fixed Html Dropdown positioning when near bottom of screen

Open DidiDerDenker opened this issue 1 year ago • 12 comments

Fixes: #2820

Summary: Fixed positioning in order to prevent html dropdown to go off screen when its near the bottom of a page.

Changes: Added mouse-teleport-class in order to reset the position of a dropdown, used in chromium-web-browser.

How Has This Been Tested?
The assemblies are able to build. The example of the solution worked. The example that was pointed out in issue 2820 worked.

Types of changes

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Updated documentation

Checklist:

  • [x ] Tested the code (if applicable)
  • [x] Commented my code
  • [ ] Changed the documentation (if applicable)
  • [ ] New files have a license disclaimer
  • [x ] The formatting is consistent with the project (project supports .editorconfig)

Big thanks to "carrierdown". He provied the solution a few month ago, but it was never merged as a pull request.

DidiDerDenker avatar Nov 30 '23 14:11 DidiDerDenker

:x: Build CefSharp 119.1.20-CI4882 failed (commit https://github.com/cefsharp/CefSharp/commit/71ad0f9ffa by @)

AppVeyorBot avatar Nov 30 '23 14:11 AppVeyorBot

  • Commented my code

New class needs to be commented.

amaitland avatar Dec 01 '23 07:12 amaitland

@amaitland

This will need some major refactoring before it can be considered for merge.

🢂 Thank you so much for reviewing the PR! Your comments were very helpful and I tried my best to change the code accordingly. I hope the PR gets closer to being considered for merge.

New class needs to be commented.

🢂 Done.

DidiDerDenker avatar Dec 12 '23 07:12 DidiDerDenker

:white_check_mark: Build CefSharp 119.1.20-CI4886 completed (commit https://github.com/cefsharp/CefSharp/commit/02e48b840b by @)

AppVeyorBot avatar Dec 12 '23 07:12 AppVeyorBot

:white_check_mark: Build CefSharp 120.1.80-CI4901 completed (commit https://github.com/cefsharp/CefSharp/commit/ac0262f4e8 by @)

AppVeyorBot avatar Dec 21 '23 07:12 AppVeyorBot

:white_check_mark: Build CefSharp 120.1.80-CI4908 completed (commit https://github.com/cefsharp/CefSharp/commit/6803ebc7d8 by @)

AppVeyorBot avatar Jan 02 '24 09:01 AppVeyorBot

:white_check_mark: Build CefSharp 120.1.80-CI4909 completed (commit https://github.com/cefsharp/CefSharp/commit/c4e6d341f1 by @)

AppVeyorBot avatar Jan 09 '24 06:01 AppVeyorBot

:white_check_mark: Build CefSharp 120.1.80-CI4923 completed (commit https://github.com/cefsharp/CefSharp/commit/a2d5222d31 by @)

AppVeyorBot avatar Jan 16 '24 20:01 AppVeyorBot

:white_check_mark: Build CefSharp 120.1.80-CI4930 completed (commit https://github.com/cefsharp/CefSharp/commit/d78ecf02be by @DidiDerDenker)

AppVeyorBot avatar Jan 23 '24 07:01 AppVeyorBot

@amaitland How do we continue from here? I updated this branch and all comments are solved as far as I know.

DidiDerDenker avatar Jan 23 '24 08:01 DidiDerDenker

The changes need testing. As there's currently no unit tests for the new class, it may be a take some time to validate this.

You can see if anyone subscribed to #2820 is prepared to test and report back.

amaitland avatar Jan 24 '24 04:01 amaitland

As nobody has volunteered to test this we can look at including it as an opt in feature.

  • Extract interface
  • Add two implementations one that does nothing and one that performs the transform.
  • Allow for opting in to using the new implementation.

amaitland avatar Feb 11 '24 21:02 amaitland

As nobody has volunteered to test this we can look at including it as an opt in feature.

  • Extract interface
  • Add two implementations one that does nothing and one that performs the transform.
  • Allow for opting in to using the new implementation.

@amaitland Thank you! I extraced an interface and added an implementation that doesn't adjust anything. I'm not sure how to implement the "opt-in". I added prototypical code in the constructor of "ChromiumWebBrowser". Could you give me an advice on where and how to implement the "opt-in" in the best way? Thanks :)

DidiDerDenker avatar Feb 27 '24 07:02 DidiDerDenker

:x: Build CefSharp 121.3.70-CI4942 failed (commit https://github.com/cefsharp/CefSharp/commit/a40dbed132 by @)

AppVeyorBot avatar Feb 27 '24 08:02 AppVeyorBot

Thanks for all the hard work. This has been merged, with follow up changes from PR #4759

You can enable the transform via an extension method:

using CefSharp.Wpf.Experimental;

chromiumWebBrowser.UsePopupMouseTransform();

Once this has been tested sufficently we can remove the method and enable it by default.

amaitland avatar Mar 15 '24 22:03 amaitland

@amaitland Great, thank you! Thanks for your help as well. In which version is it going to be released?

DidiDerDenker avatar Mar 19 '24 08:03 DidiDerDenker

Next major version (M123).

Hopefully released in about a week.

amaitland avatar Mar 20 '24 09:03 amaitland