vaadin / vaadin/framework

Extending a Button with FileDownloader causes any keyboard shortcut added with setClickShortut to not work

Open
#11,012 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question Stale
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Found using Chrome, Vaadin 8.4.3, Wildfly 10.1

To reproduce create a Button and add a keyboard shortcut using something like:

Button btnDownload = new Button(VaadinIcons.DOWNLOAD, event -> System.out.println("download"));
btnDownload.setClickShortcut(KeyCode.P, ModifierKey.CTRL);

The button (if you added a click listener) is triggered when you click it or press Ctrl-P.
Then take out the click handler and extend with FileDownloader:

Button btnDownload = new Button(VaadinIcons.DOWNLOAD);
btnDownload.setClickShortcut(KeyCode.P, ModifierKey.CTRL);
StreamResource downloadResource = getDownloadResource();
FileDownloader fileDownloader = new FileDownloader(downloadResource);
fileDownloader.extend(btnDownload);

The download works if you click the button, but it no longer works if you press Ctrl-P.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Button keyboard-shortcut path and the FileDownloader.extend(btnDownload) path described in the reproduction. Verify the behavior with the provided Ctrl-P examples; done means a button extended with FileDownloader still triggers its download when the configured keyboard shortcut is pressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.