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

CEF BrowserComponent: mouse events handled differently in Android device than simulator #3378

Open
P5music opened this issue Feb 26, 2021 · 0 comments
Assignees

Comments

@P5music
Copy link

P5music commented Feb 26, 2021

I created a test case. (You find the relevant code below)
The test app features a CEF BrowserComponent with some text inside.
Text lines are not so long horizontally to fill the view, so the right part is empty.
Also the bottom part is empty because only a few text lines are in the HTML.

On the Android device:
I can click on text and I have the mousedown/mouseup sequence (events are fired and callbacks are issued) (-> OK).
I can click on the empty part on the right and I have the mousedown/mouseup sequence (events are fired and callbacks are issued) (-> OK).

If I click on the empty part on the bottom I have no callbacks (-> OK).

If I long-press on the text the Android text-selection interface appears (-> OK).
If I long-press on the empty part on the right no callbacks are issued (this is the problem this thread is about, and also see below) (-> not OK) .

I remind that the empty part on the right is a DIV with the callbacks on it.
And the bottom part is really empty.

So, for my app to work
-the long-press events should be issued also on the text, if present in the iFrames
because in my app the iFrames have this attribute setting:

iframe.style.pointerEvents="none";.

In the simulator mouse events for long-press are correctly fired
but
in the Android device the text-selection interface appears also when the iFrame has the above mentioned attribute (-> not OK).
So this is another facet of the issue, I think it is the same issue, but it is not in the test case I sent the build.
It easy to reproduce setting a suitable attribute in HTML elements, you should see that the text is selectable (not ok).

Regards
`public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Hi World");
hi.setLayout(new BorderLayout());
hi.add(BorderLayout.NORTH,new Label("Hi World"));
BrowserComponent bc=new BrowserComponent();

bc.addWebEventListener("onLoad", new ActionListener() {
@OverRide
public void actionPerformed(ActionEvent evt) {
System.out.println("onload");
bc.addJSCallback("var div=document.getElementById('divId');" +
"callMouseDown =function(){callback.onSuccess('mousedown');};callMouseUp =function(){callback.onSuccess('mouseup');};"+
"div.addEventListener('mousedown', function () {"+
"callMouseDown();"+
"});"+
"div.addEventListener('mouseup', function () {"+
"callMouseUp();"+
"});"
, new SuccessCallback<BrowserComponent.JSRef>() {
@OverRide
public void onSucess(BrowserComponent.JSRef value) {
System.out.println("webview callback value="+value.getValue());
}});
}
});

//here there is HTML but it seems that it gets not displayed inside the "code" quotes
bc.setPage("

TEST
TEST
TEST
TEST
TEST
TEST
TEST
","");

hi.add(BorderLayout.CENTER,bc);
hi.show();
}`

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

No branches or pull requests

2 participants