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

ZK-5743: clicking menuitem fires 2 onClick events in mobile browser #3201

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions extends.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* extends.js

Purpose:

Description:

History:
1:02 PM 2023/8/21, Created by jumperchen

Expand All @@ -18,8 +18,9 @@ var extendStatics = function(d, b) {

// refer tslib#__extends
export default function (d, b) {
const len = Object.keys(d.prototype).length; // Potix: Jumper Chen adds to support `$supers(foo.Bar, 'bind_')`
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
d.prototype._$super = d.name == '$subclass$' && b.prototype._$super ? b.prototype._$super : b.prototype; // Potix: Jumper Chen adds to support `$supers(foo.Bar, 'bind_')`
d.prototype._$super = len === 0 && b.prototype._$super ? b.prototype._$super : b.prototype; // Potix: Jumper Chen adds to support `$supers(foo.Bar, 'bind_')`
}
1 change: 1 addition & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ZK 10.1.0
ZK-5703: Debug messages shouldn't be created if debug is disabled, may cause side effects
ZK-5716: Errorbox contains inline script
ZK-5787: aria-hidden elements do not contain focusable elements
ZK-5743: clicking menuitem fires 2 onClick events in mobile browser

* Upgrade Notes
+ Remove Htmls.encodeJavaScript(), Strings.encodeJavaScript(), Strings.escape() with Strings.ESCAPE_JAVASCRIPT, and replace them with OWASP Java Encoder APIs instead.
Expand Down
11 changes: 11 additions & 0 deletions zktest/src/main/webapp/test2/B101-ZK-5743-zk.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<zk>
<client-config>
<debug-js>false</debug-js>
</client-config>

<library-property>
<name>org.zkoss.zkmax.tablet.ui.disabled</name>
<value>false</value>
</library-property>
</zk>
25 changes: 25 additions & 0 deletions zktest/src/main/webapp/test2/B101-ZK-5743.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
B101-ZK-5743.zul

Purpose:

Description:

History:
2024/9/13, Created by jumperchen

Copyright (C) 2024 Potix Corporation. All Rights Reserved.

-->
<zk>
<div>
<label multiline="true">
Clicking menuitem fires 2 onClick events in mobile browser (if disabled debug-js in zk.xml)
</label>
<menubar autodrop="true">
<menuitem onClick="Clients.log(event.toString())" iconSclass="z-icon-cog" label="menuitem1"/>
</menubar>
</div>
</zk>
1 change: 1 addition & 0 deletions zktest/src/main/webapp/test2/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,7 @@ B90-ZK-4431.zul=A,E,Multislider
##zats##B101-ZK-5696.zul=A,E,NestedShadow,ServerMVVM,ForEach,Differ
##zats##B101-ZK-5716.zul=A,E,CSP,Security,Content-Security-Policy,Unsafe-inline
##zats##B101-ZK-5787.zul=A,E,WCAG,Accessibility,Focus,Tabindex,Aria-hidden
##zats##B101-ZK-5743.zul=A,E,Compressed,JS,Debug-JS,TabletUI,Mobile,onClick

##
# Features - 3.0.x version
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* B101_ZK_5743Test.java

Purpose:

Description:

History:
12:17 PM 2024/9/13, Created by jumperchen

Copyright (C) 2024 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zktest.zats.test2;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Collections;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openqa.selenium.chrome.ChromeOptions;

import org.zkoss.test.webdriver.ExternalZkXml;
import org.zkoss.test.webdriver.ForkJVMTestOnly;
import org.zkoss.test.webdriver.WebDriverTestCase;

/**
* @author jumperchen
*/
@ForkJVMTestOnly
public class B101_ZK_5743Test extends WebDriverTestCase {

@RegisterExtension
public static final ExternalZkXml CONFIG = new ExternalZkXml(
B101_ZK_5743Test.class);

@Override
protected ChromeOptions getWebDriverOptions() {
return super.getWebDriverOptions()
.setExperimentalOption("mobileEmulation", Collections.singletonMap("deviceName", "iPad"));
}

@Test
public void test() {
connect();
click(jq("@menuitem"));
waitResponse();
String zkLog = getZKLog();
long count = zkLog.split("onClick").length - 1;
assertEquals(1, count);
}
}
Loading