Esc should close teleport dialog

mariuss - February 9, 2008 - 19:40
Project:Teleport
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:incidentist
Status:closed
Description

Hitting the Escape key should close the teleport dialog box (window).

#1

Xano - February 10, 2008 - 18:53

Hmm, I'm thinking if it would be wise to use ESC as a hotkey. It's not unlikely some software on the user's computer has already used ESC for some feature. I think normal hotkeys like what's being used at this moment would be best. Not best for the module itself in means that using the module won't become easier, but best in means that it won't conflict with other software and that it's consistent.

Remember, it's not Quicksilver, just an imitation, a web 'application'.

#2

incidentist - February 10, 2008 - 19:11
Assigned to:Anonymous» incidentist

Oh, I think it's a good idea. There've been a bunch of times when I've reflexively hit Esc and expected Teleport to close. Also, the standard autocomplete form already intercepts Esc to hide the list of autocompleted items. I've just got to change that interception to close the whole dialog if the list is already hidden.

#3

moshe weitzman - February 10, 2008 - 20:30

FYI, I expected this too.

#4

jjeff - February 15, 2008 - 00:25

Okay, here's a patch that does the following things:

1) Makes the ESC key close the modal box.
2) Makes any click anywhere outside of the modal box close Teleport
3) Changes the show/hide actions to fadeIn/fadeOut so that the whole box fades in/out rather than animating size

Other things to be aware of with this patch.
* It adds an id of "teleport-button" to the teleport button. This is needed in order to exclude it from the document.click action.
* The patch removes a few lines of what looked like leftover variable definitions.

#5

jjeff - February 15, 2008 - 00:25
Status:active» needs review

d'oh... here's the patch...

AttachmentSize
teleport-esc-click-close.patch 2.98 KB

#6

jjeff - February 15, 2008 - 00:26
Version:6.x-1.x-dev» 5.x-1.x-dev

patch is actually against 5.x... dunno if .js files are the same between versions...

#7

jjeff - February 15, 2008 - 02:31

Okay, I'll admit this is getting ridiculous now.

Here's a patch that (in addition to the above features) adds IE compatibility by changing the method from the 'accesskey' trick to a $(document).keydown() listener.

Tested and working in Safari (Mac), Firefox (Mac), and Internet Explorer (Win). NOT working in Opera on the Mac, but also not breaking anything.

Technically this is a fix to another issue, but since it builds on the code for this issue/patch, I thought it made more sense to post here.

At this point, the patch is larger than the entire teleport.js file, so I've also included the entire file here too.

AttachmentSize
teleport-esc-click-close-ie.patch 3.56 KB
teleport.js_.txt 2.74 KB

#8

incidentist - February 15, 2008 - 18:38

Ridiculous? Ridiculously awesome, more like. I'll take a look and try to commit it within the next couple of days. I looked briefly at the IE accesskey issue, and it looks like there may be a non-hack solution but it is (blissfully) difficult for me to get access to an IE6 box for testing.

#9

psynaptic - February 16, 2008 - 09:31

I'll can test IE (as well as other browsers on Win) and also any browsers on Mac too. Just let me know and I'm there.

#10

jjeff - February 16, 2008 - 18:24

Psynaptic, yes, please test! Any and all testing is always helpful.

Thanks.

#11

psynaptic - February 19, 2008 - 08:43

Hey Jeff, I've just check my track and found this.

I'm working on a client site right now but will do some testing on this ASAP. Is there anything you feel needs particular attention?

#12

psynaptic - February 24, 2008 - 19:47

I've been testing and it seems to work well so far. The only problem I have is that I like to use ` backtick/tilde key to invoke. I'll try and see if I can fix it.

#13

incidentist - March 5, 2008 - 22:50
Status:needs review» fixed

Applied the patch, tested on FF/Mac and IE6. Works well so I committed it.

#14

Anonymous (not verified) - March 19, 2008 - 23:55
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.