Skip to content

Conversation

@tsohr
Copy link
Contributor

@tsohr tsohr commented Mar 10, 2017

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and because the event was already handled by Fancytree's hotkey plugin.

$(tree.$container).on(event, null, key, function(evt) {
var node = tree.getActiveNode();
handler(node);
evt.preventDefault();
Copy link
Owner

@mar10 mar10 Mar 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be more flexible to let the handler decide whether he wants to prevent default handling, stop propagation or both?
What do you think about passing evt to the handler (which may be useful in itself), The handler can then inspect the event or call methods on it.
The main use case (stopping default handling) could be made easier to implement if we return the handler's response:

return handler(node, evt);

This would allow handlers to simply return false.

If you feel that this is too much burden on the handlers, then I suggest that we make the 'prevent default' behavior configurable in the plugin options.

Copy link
Contributor Author

@tsohr tsohr Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're correct. Changing handler(node) to return handler(node, evt); + handler's return false is much simpler and flexible.

One more request, a single line of comment on jquery.fancytree.hotkeys.js or on your example browser for about how to write hotkey handler function will clear this issue and much appreciated. And yes being an explicit plugin option would be good too.

Reject this change please and your answer is much better.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if you update your PR (changing the line to return handler(node, evt); and remove evt.preventDefault()), I will merge :)
Feel free to add a comment to the example as well.

tsohr added a commit to tsohr/fancytree that referenced this pull request Mar 20, 2017
As discussion on mar10#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.
tsohr pushed a commit to tsohr/fancytree that referenced this pull request Mar 20, 2017
tsohr added 3 commits March 20, 2017 17:29
Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.
As discussion on mar10#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.
@tsohr
Copy link
Contributor Author

tsohr commented Mar 20, 2017

Hi @mar10 , Done that updated for the plugin code and example. Thanks!

@mar10
Copy link
Owner

mar10 commented Mar 20, 2017

Thanks!

@mar10 mar10 merged commit 19ca808 into mar10:master Mar 20, 2017
uc5288 added a commit to uc5288/6s that referenced this pull request May 17, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
lynnldvemin added a commit to lynnldvemin/ceabie8 that referenced this pull request May 26, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
lifeifeixzx added a commit to lifeifeixzx/agarwlq that referenced this pull request May 30, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
StudioSpindler added a commit to StudioSpindler/anda that referenced this pull request Jun 10, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
PatrickSier added a commit to PatrickSier/pthread that referenced this pull request Jun 10, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
HeXPixCat added a commit to HeXPixCat/EAGLE that referenced this pull request Jun 13, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
motorHillary added a commit to motorHillary/compact that referenced this pull request Jun 13, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
yoosJacob added a commit to yoosJacob/kanthn that referenced this pull request Jun 14, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
KeithJasons pushed a commit to KeithJasons/jaso that referenced this pull request Jun 15, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
Gustave73 pushed a commit to Gustave73/learn-co-studentsm that referenced this pull request Jul 2, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
LionPearNews pushed a commit to LionPearNews/Glasklart that referenced this pull request Jul 3, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
JosepehWilson added a commit to JosepehWilson/campbell that referenced this pull request Jul 6, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
MarkeJohnson added a commit to MarkeJohnson/written that referenced this pull request Jul 7, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
JoeFortunato added a commit to JoeFortunato/flathub that referenced this pull request Jul 14, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
GriseldaKnight added a commit to GriseldaKnight/happiness that referenced this pull request Jul 15, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
JudithClake added a commit to JudithClake/nihui that referenced this pull request Jul 20, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
JoyceMoonTse added a commit to JoyceMoonTse/BadWolf that referenced this pull request Jul 20, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
346151535 added a commit to 346151535/negraph that referenced this pull request Jul 22, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
MachinesWhisper added a commit to MachinesWhisper/fdress that referenced this pull request Jul 29, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
892736633 added a commit to 892736633/Solarflare that referenced this pull request Aug 13, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
8937276151 added a commit to 8937276151/FirstSpirit that referenced this pull request Sep 16, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
LeoVS0 added a commit to LeoVS0/nvim that referenced this pull request Oct 7, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
jbkempfe added a commit to jbkempfe/ubiquitous that referenced this pull request Oct 11, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
annabelledam added a commit to annabelledam/contaminant that referenced this pull request Oct 14, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
dnfclass added a commit to dnfclass/rattle that referenced this pull request Oct 15, 2025
* Prevent default behavior on hot key combination

Key combination stroke (like ctrl+d, ctrl+s) will trigger browser's default behavior which is expected to be prevented and not for else because the event was already handled by fancytree's hotkey plugin.

* Hot key handler now receives event object together

As discussion on mar10/fancytree#701, plugin to give `evt` to handlers, and handler can work with the `evt` object.

* Add Ctrl+D hotkey example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants