Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

use ESC-key to end search mode in browse form [done]

Post your ideas & suggestions for new nuBuilder features or other improvements
Post Reply
Gnu
Posts: 14
Joined: Fri Jan 07, 2022 10:38 am
Has thanked: 57 times

use ESC-key to end search mode in browse form [done]

Unread post by Gnu »

To exit the search mode in browse form, one should manually click in the search field, delete the search term and press the Enter key.
With the suggested code, one can simply press the escape key.

Code is here (last else if branch) and on Github https://github.com/nuBuilder/nuBuilder-4.5/pull/21:

Code: Select all

	$(document).keydown(function(e) {

		if (e.keyCode == 27) {										//-- ESC

			if (nuIsVisible('nuMessageDiv')) {
				$('#nuMessageDiv').remove();
			} else if (nuIsVisible('nuOptionsListBox')) {
				$('#nuOptionsListBox').remove();
			} else if ($('.ctxmenu').is(':visible')) {
				nuContextMenuClose();	
			} else if (parent.$('#nuModal').length == 1) {
				let ae = document.activeElement;
				$(ae).blur();
				$(ae).focus();
				if (nuFormsUnsaved() == 0) nuClosePopup();
                        } else if (nuFormType() == 'browse') {
                                nuSearchAction("");
			}
		}
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: use ESC-key to end search mode in browse form

Unread post by kev1n »

Hi Gnu,

The suggestion makes sense. I've merged our PR. Thanks for your contribution!
Post Reply