command-pal icon indicating copy to clipboard operation
command-pal copied to clipboard

able to exit from palette using 1 or more backspaces on empty search

Open rouilj opened this issue 2 years ago • 1 comments

On mobile, there is no good way to exit from the palette using the keyboard. Most mobile keyboards don't have ESC keys, or they are on a secondary keyboard layout. The backspace key however is usually available on the primary keyboard layout.

This patch adds the ability to configure the number of consecutive backspaces to exit the palette. The backspaces only count if the search input is empty. If the number of required backspaces is > 1, the number of remaining backspaces is shown if it is less than 5. This feedback is generated by a template string. i18n may be an issue. YAGNI says not to fix this now 8-) .

Docs updated no examples changed. Works in Firefox and Chrome mobile and desktop.

NOTE: this also patches the onKeyDown in SearchField to use e.key rather than e.code otherwise it doesn't work on mobile where it is most useful.

rouilj avatar Feb 09 '23 00:02 rouilj

If you want to try it, go to: https:// rouilj.dynamic-dns.net/demo (remove the space) and try typing he then backspace over it, emptying the search input, and then one more time and follow directions 8-).

rouilj avatar Feb 11 '23 05:02 rouilj