Repository navigation
fix: accept any component in click-gesture onClick methods - #26650
Merged
Merged
Conversation
The click-gesture APIs only attach a DOM click listener to the component's root element and never use ClickNotifier, so requiring it blocked components such as menu items that are clickable in the browser but do not implement the interface. The erased signatures stay onClick(Component, ...), so the change is binary compatible.
Contributor
Author
Type of change
API changes5 classes affected, 7 methods changed (parameter type widened, erasure unchanged) // com.vaadin.flow.component.clipboard.Clipboard
- public static <T extends Component & ClickNotifier<?>> ClipboardBinding onClick(T component)
+ public static ClipboardBinding onClick(Component component)
// com.vaadin.flow.component.webshare.WebShare
- public static <T extends Component & ClickNotifier<?>> WebShareBinding onClick(T component)
+ public static WebShareBinding onClick(Component component)
// com.vaadin.flow.component.fullscreen.Fullscreen
- public static <T extends Component & ClickNotifier<?>> FullscreenBinding onClick(T component)
+ public static FullscreenBinding onClick(Component component)
// com.vaadin.flow.component.download.Download
- public static <T extends Component & ClickNotifier<?>> Registration onClick(T component, DownloadHandler handler)
+ public static Registration onClick(Component component, DownloadHandler handler)
- public static <T extends Component & ClickNotifier<?>> Registration onClick(T component, String url)
+ public static Registration onClick(Component component, String url)
- public static <T extends Component & ClickNotifier<?>> Registration onClick(T component, String url, String fileName)
+ public static Registration onClick(Component component, String url, String fileName)
// com.vaadin.flow.component.newtab.OpenInNewTab
- public static <T extends Component & ClickNotifier<?>> Registration onClick(T component, DownloadHandler handler)
+ public static Registration onClick(Component component, DownloadHandler handler)
- public static <T extends Component & ClickNotifier<?>> Registration onClick(T component, String url)
+ public static Registration onClick(Component component, String url) |
|
Contributor
Artur-
marked this pull request as ready for review
October 23, 2026 11:43
vaadin-review-bot
left a comment
Collaborator
There was a problem hiding this comment.
✅ Nothing to flag — the changes look good.
mshabarov
approved these changes
Oct 23, 2026
vaadin-bot
added a commit
to vaadin/docs
that referenced
this pull request
Oct 23, 2026
Clipboard.onClick() and WebShare.onClick() now accept any clickable component, not only ones implementing ClickNotifier. Documents vaadin/flow#26650 (`dc3310dd065caab3ab07b2e37e055a2600d4b32d`).
Contributor
|
Pull request created: #6484
|
Contributor
|
Documentation Bot: Draft documentation pull request for this change: vaadin/docs#6484 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.
|
Artur-
pushed a commit
to vaadin/docs
that referenced
this pull request
Oct 23, 2026
) Documentation for vaadin/flow#26650 by `@totally-not-ai`[bot]. > [!NOTE] > The source pull request is merged, so this documentation describes the final > shape of the change. Please review it and mark it ready for review. **Change categories:** API_CHANGE | File | Change | |------|--------| | `articles/flow/browser-apis/clipboard-api.adoc` | "Other Click Sources" no longer says `Clipboard.onClick()` requires `ClickNotifier` -- it accepts any component | | `articles/flow/browser-apis/web-share-api.adoc` | "Sharing on Click" no longer says the trigger must implement `ClickNotifier` -- any component whose root element receives the click works, including menu items | Auto-generated by the Documentation Bot — review before merging. > Generated by [Documentation Bot](https://github.com/vaadin/flow/actions/runs/39966647336) for #26650 · agent · 83 AIC · ⊞ 6.6K · [◷](https://github.com/search?q=repo%3Avaadin%2Fdocs+%22gh-aw-workflow-id%3A+doc-bot%22&type=pullrequests) > - [x] expires <!-- gh-aw-expires: 2026-11-22T14:12:01.563Z --> on Nov 22, 2026, 2:12 PM UTC <!-- gh-aw-agentic-workflow: Documentation Bot, engine: claude, model: agent, id: 39966647336, workflow_id: doc-bot, run: https://github.com/vaadin/flow/actions/runs/39966647336 --> <!-- gh-aw-expires-type: pull-request --> <!-- gh-aw-workflow-id: doc-bot --> <!-- gh-aw-workflow-call-id: vaadin/flow/doc-bot -->
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.



Review risk: two-way door — widens the parameter type of seven static
onClickmethods; binary and source compatible for existing callers.missing API · flow-server · apps that want a clipboard, share, fullscreen, download or new-tab action on a component that is not a
ClickNotifier, such as a context menu itemThe click-gesture helpers (clipboard write, web share, fullscreen, download, open in new tab) required the clicked component to implement
ClickNotifier, but they only listen for the browserclickevent on the component's root element and never use that interface. Components that are clickable in the browser but do not implement it, such asGridMenuItem, could only be used through an unchecked cast. The helpers now accept anyComponent.Risks:
<T extends Component & ClickNotifier<?>> TtoComponentonClipboard,WebShare,Fullscreen,DownloadandOpenInNewTabonClickmethods. The erased signature was alreadyonClick(Component, ...), so compiled code keeps linking, and existing call sites (including explicit type arguments) still compile.✅ No behaviour, security, memory, serialization, threading or performance impact.
Changed
Clipboard.onClick,WebShare.onClick,Fullscreen.onClick,Download.onClick(3 overloads) andOpenInNewTab.onClick(2 overloads) to take aComponent, and removed theClickNotifiertype parameter from their Javadoc.Changed the test fixtures of these classes to use a plain component instead of a
ClickNotifier, so the existing tests cover the wider type.Working on behalf of Artur