cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
372
Views
0
Helpful
3
Replies

BackSpaceHandler utility in Finesse 11.5

dagueci91
Level 1
Level 1

In Finesse 11.5 a new utility has been included in Finesse.js called BackSpaceHandler. From the description, it states that the intent of this function is to stop the page from navigating backwards (by calling event.preventDefault()). This is done by attaching a "keydown" event listener to the window.

The problem is that while default behavior is not prevented for almost all input fields (e.g. input, text, textarea, etc.), it is prevented for contenteditable divs. So when one of my gadgets has a contenteditable div and I press backspace, nothing happens (the text in the div is not removed).

The solution seems to me to be to add the condition to check if the target element is a contenteditable div, the same as it is checked for other input elements.

I can't think of a way to resolve this issue without getting a patched Finesse.js since the event handler is attached to the window, and I don't think it would be possible to remove that handler from the context of my gadget.

Any guidance or clarification would be appreciated.

Thanks,

Daniele

1 Accepted Solution

Accepted Solutions

dekwan
Cisco Employee
Cisco Employee

Hi Daniele,

Sorry for the delay, it took a little bit of investigation to look into this.

Other than a patch in the finesse.js (which will probably not happen quickly), you can:

  • Use a Text Area
  • Attach a keydown callback to the div where content is editable and in this callback, prevent the event from bubbling up (to window). This way the div content will be editable. (Sample code attached)

I hope this helps.

Thanx,

Denise

View solution in original post

3 Replies 3

dekwan
Cisco Employee
Cisco Employee

Hi Daniele,

I am looking into this and will get back to you when I have an answer.

Thanx,

Denise

dekwan
Cisco Employee
Cisco Employee

Hi Daniele,

Sorry for the delay, it took a little bit of investigation to look into this.

Other than a patch in the finesse.js (which will probably not happen quickly), you can:

  • Use a Text Area
  • Attach a keydown callback to the div where content is editable and in this callback, prevent the event from bubbling up (to window). This way the div content will be editable. (Sample code attached)

I hope this helps.

Thanx,

Denise

Hi Denise,

We ended up using the second approach which is working perfectly.

Thanks a lot for your assistance.

Daniele