Repository navigation
feat: send click count filters as declared JS snippets - #26952
Merged
Merged
Conversation
The single-click and double-click listeners of ClickNotifier no longer send a filter string that the browser compiles, so they work under a Content Security Policy without 'unsafe-eval'. Part of #26667
Contributor
Author
Type of change
How to test
API changescom.vaadin.flow.component.ClickNotifier// Added
public interface ClickNotifier.ClickFiltersJs extends Serializable // internal; nested in an interface, so implicitly public
public DomEventFilter isClickCountBetween(int min, int max) |
mcollovati
marked this pull request as ready for review
November 10, 2026 09:40
vaadin-review-bot
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the changes — left 1 comment.
| Finding | |
|---|---|
| 📐 | The new script-click test checks the result right after a server round trip instead of waiting for it. |
|
Contributor
mcollovati
approved these changes
Nov 10, 2026
vaadin-review-bot
left a comment
Collaborator
There was a problem hiding this comment.
✅ Nothing to flag — the changes look good.
vaadin-bot
added a commit
to vaadin/docs
that referenced
this pull request
Nov 10, 2026
Remove the "event data of click listeners" example from the csp property and Content Security Policy page: single and double click listeners now use a declared filter, so they no longer need eval. Documents vaadin/flow#26952 (`37dc8a20ea48b0b64507d41dfd9ec43f950c4296`).
Contributor
|
Pull request created: #6615
|
Contributor
|
Documentation Bot: Draft documentation pull request for this change: #aw_docspr Files updated:
It was written from the state of this pull request as you see it now. Please review it and mark it ready for review.
|
Collaborator
|
This ticket/PR has been released with Vaadin 25.4.0-alpha7. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Fixes #26667
behavior deviation · flow-server · apps using single-click or double-click listeners under a Content Security Policy without
unsafe-evalBackground — event filters. A DOM listener can have a filter that decides in the browser whether an event is sent to the server. A filter written as a string is compiled with
new Function, which a Content Security Policy withoutunsafe-evalblocks. A filter declared in a@JsDefinitioninterface is in the bundle instead, so nothing is compiled.Single-click and double-click listeners now use a declared filter, so they work without
unsafe-evaland are no longer reported in the warn and strict CSP modes. They accept the same clicks as before.Risks:
ClickNotifier.ClickFiltersJsis public because nested types of an interface always are. Its Javadoc marks it as internal.Context. The other call sites listed in the issue are already covered:
preventDefault()andstopPropagation()by #26845, and property paths such asevent.detail,event.wandevent.hby #26916.event.detail == 2andevent.detail <= 1string filters ofaddDoubleClickListenerandaddSingleClickListenerwith one declared filter,isClickCountBetween(min, max).CspModeTestfrom the list of violations to the calls that must not report one, and added the single-click case there.ImageClickITfor a click fired by the JavaScriptclick()function, which has a click count of 0.