Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeKeyDown -> event.stopImmediatePropagation() doesn't work #2207

Closed
jarben opened this issue Mar 1, 2015 · 13 comments
Closed

beforeKeyDown -> event.stopImmediatePropagation() doesn't work #2207

jarben opened this issue Mar 1, 2015 · 13 comments

Comments

@jarben
Copy link

jarben commented Mar 1, 2015

I've tried the latest 0.12.6 version and noticed:
beforeKeyDown:function(ev){
ev.stopImmediatePropagation();
}

doesn't work anymore..

try: http://jsfiddle.net/0bg3cLjy and notice you can make changes in the editor by pressing keydown

@jarben
Copy link
Author

jarben commented Mar 1, 2015

found a workaround for this by calling:
ev.isImmediatePropagationEnabled = false;
ev.isImmediatePropagationStopped = function(){
return true;
};

instead of ev.stopImmediatePropagation();

@Lukazar
Copy link

Lukazar commented Mar 4, 2015

You could also add Handsontable.Dom.enableImmediatePropagation(ev); at the top of your function as shown here.

@AMBudnik
Copy link
Contributor

I assume it not an issue anymore (in lack of recent activity and any other questions.)

@FeepingCreature
Copy link

You assume wrong. At least the documentation should be fixed. It advocates ev.stopImmediatePropagation() in places.

@AMBudnik
Copy link
Contributor

Ok thanks @FeepingCreature for your suggestion.

@AMBudnik AMBudnik reopened this Jun 19, 2015
vo-va added a commit to vo-va/handsontable that referenced this issue Oct 27, 2015
Extend native method `event.stopImmediatePropagation()` to
stop event propagation in Handsontable event manager.
@AMBudnik AMBudnik added Docs: Content Issues related to Handsontable's documentation content Type: Improvement suggestion Core: Callbacks Plugin labels Feb 19, 2016
@AMBudnik
Copy link
Contributor

AMBudnik commented Mar 7, 2016

I'm transferring all the improvement suggestion to our Wiki section at: improvement suggestions

Please feel free to add any additional suggestions/tips or investigation results.

Issue is closed. It will be reopened with a developing update.

@AMBudnik AMBudnik closed this as completed Mar 7, 2016
@arfis
Copy link

arfis commented Jan 23, 2018

At the moment im working in angular with handsonetable and i cant make it work.. the version is 2.0.0. It is a very crucial functionality which I need. Can you please help me out with it?

@AMBudnik
Copy link
Contributor

Can I ask you to create a demo @arfis ?

@arfis
Copy link

arfis commented Jan 23, 2018

i have created an demo on git.. https://github.com/arfis/angularTest. The TableComponent contains the table.

@AMBudnik
Copy link
Contributor

When I wanted to clone the repository I got an error and a note that I do not have a permission to do this.
Can you use a JS playground to create a demo? If not. Write me at support@handsontable.com

@arfis
Copy link

arfis commented Jan 23, 2018

I have written you a mail

@jsessink
Copy link

For those who may come across this having issues with this via Angular and accessing KeyboardEvent with the beforeKeyDown hook, here's are your options to being able to use preventDefault / stopImmediatePropagation as noted in the docs:

  • Use the directive, which will supply the HOTInstance and the event list with KeyboardEvent as the first index.

Eg usage (in the directive):
image

image

  • Use the settings instead of the directive. This will give you access to the actual KeyboardEvent directly, instead of the HOTInstance and event list.

Eg usage (in the settings):
image

image

@AMBudnik
Copy link
Contributor

To updated the subject I've just check v8.4.0 on

and it works well in all of the cases with a simple implementation of

beforeKeyDown: function(ev) {
            ev.stopImmediatePropagation();
}

@AMBudnik AMBudnik added Status: Answered and removed Core: Callbacks Plugin Docs: Content Issues related to Handsontable's documentation content Type: Improvement suggestion labels May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants