The enable_webview_click setting in Enterprise WeChat custom workbench was not working properly when H5 elements inside the webview needed to capture click events. The issue occurred because null Boolean values were being serialized as "enable_webview_click": null in the JSON payload instead of being omitted entirely.
Problem
When enableWebviewClick or hideTitle Boolean fields were null in WxCpAgentWorkBench, they were being serialized as explicit null values in the JSON:
This caused the WeChat Enterprise API to not properly handle the webview click functionality, preventing H5 element click events from being captured even when the setting appeared to be configured correctly.
Solution
Added null checks for Boolean fields in both handle() and handleBatch() methods, following the same pattern already used for replaceUserData:
if (this.enableWebviewClick != null) {
webview.addProperty("enable_webview_click", this.enableWebviewClick);
}
if (this.hideTitle != null) {
webview.addProperty("hide_title", this.hideTitle);
}
Now when these fields are null, they are omitted from the JSON entirely, allowing the WeChat API to apply proper defaults. When explicitly set to true or false, they work as expected.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The enable_webview_click setting in Enterprise WeChat custom workbench was not working properly when H5 elements inside the webview needed to capture click events. The issue occurred because null Boolean values were being serialized as "enable_webview_click": null in the JSON payload instead of being omitted entirely.
Problem
When enableWebviewClick or hideTitle Boolean fields were null in WxCpAgentWorkBench, they were being serialized as explicit null values in the JSON:
{ "webview": { "enable_webview_click": null, "hide_title": null } }This caused the WeChat Enterprise API to not properly handle the webview click functionality, preventing H5 element click events from being captured even when the setting appeared to be configured correctly.
Solution
Added null checks for Boolean fields in both handle() and handleBatch() methods, following the same pattern already used for replaceUserData:
Now when these fields are null, they are omitted from the JSON entirely, allowing the WeChat API to apply proper defaults. When explicitly set to true or false, they work as expected.
Fixes #3697.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.