how to delete widget decoration when I press delete key?

Hello, would someone please explain how to delete a widget decoration when I type a backspace, or a delete key? As if it was a character. Replace decorations do get deleted, but widget decorations stay.
thanks!
konstantin

The editor itself won’t do that (the command bound to delete by default just deletes text in the document, and isn’t aware of any non-document elements you may be showing), so you’d have to bind a custom command that notices the cursor is before such a decoration and somehow instructs the extension managing the decoration to remove it to delete (at a higher precedence than the default binding).