-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Implementation of Navigate Recent Projects #4546
Implementation of Navigate Recent Projects #4546
Conversation
@@ -130,6 +142,76 @@ define(function (require, exports, module) { | |||
} | |||
|
|||
/** | |||
* Hide the delete button. | |||
*/ | |||
function hideDeleteButton() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: but you should probably call this removeDeleteButton and showDeleteButton would become addDeleteButton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. These were the original names. I only moved this functions since I needed to use them and have them declared before.
done with first pass on the review |
|
||
// Register command handlers | ||
CommandManager.register(Strings.CMD_TOGGLE_RECENT_PROJECTS, TOGGLE_DROPDOWN, handleKeyEvent); | ||
KeyBindingManager.addBinding(TOGGLE_DROPDOWN, KeyboardPrefs.recentProjects); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrocknaphobia I don't think CTRL+ALT+R/CMD+ALT+R should toggle the recent projects menu.
The acceptance criteria doesn't specify the behavior but I would expect that CTRL+ALT+R/CMD+ALT+R would invoke the most Project MRU menu but only ESC, ENTER, clicking on another UI element or the Brackets Application Frame is deactivated (another top-level application window gains focus) would be the only things that dismiss it. This should be true if it were invoked from the keyboard or mouse.
@TomMalbran Thanks for taking this on! Once the menu is open (Ctrl+Alt+R), the menu should be closed when hitting ESC, ENTER or when losing focus (e.g. click outside the menu). Typically menus don't toggle (at least not on Windows), but as long as ESC/ENTER works, I'm OK if Ctrl+Alt+R toggles the menu close as well. |
@adrocknaphobia Sure, using Esc to to close the menu sounds good. Enter already closes it, since it works as clicking on any menu item. There wasn't any mention of it in the trello card, but I figure that there should be a way to close it using keyboard events. Using Alt when a native menu is open on Windows closes it, and alt is the way to open them, so maybe we could also leave Ctrl+Alt+R to close the menu. |
@adrocknaphobia One other thing. There is still no way to remove projects from the list using the keyboard (can only be done clicking on the "x" button). Should we implement it using the BackSpace/Delete keys? |
@adrocknaphobia that doesn't feel right to me. Can you point to another tool that does it like that? Visual Studio you can only close windows from the Windows... Dialog at the bottom of the Window menu. Then it's a dialog that you can use to manage your windows. I'm afraid that delete would be confused with deleting the file from disk or from your project. On the Mac, Cmd+W is the typical shortcut to close the currently open document which I believe is implemented and Alt+F4 on Windows is as well. If not, then I think we should just let them close only the currently open document with those shortcuts. That's my $.02 |
@JeffryBooher I guess you are right. Using delete to remove the files might not be the best way. Anyway I think we should make it possible to remove the projects from the list using the keyboard only. My other idea would be to make sure that tabbing works. When the menu is open tabbing should stay within the panel and should reach the "x" links. I was thinking of making the list items tab-able, so that you can tab to a list item, which will select it and show the delete icon and then tab to the delete icon. The next tab will select the following item in the list, or the first if we reached the end. |
@TomMalbran That needs a UX involvement so I wouldn't get to far down the road on that but it sounds about right. Delete I think is outside the scope of this issue so I will add it to the product backlog if it isn't already. I need to test the changes and finish the review for this pull request. |
@TomMalbran I tried this from an open document (using the keyboard to invoke the menu) and keys other than the ones that are expressly handled by the menu are going to the editor which isn't good. I then managed to get into a state with multiple popups showing because code hints popped up. This doesn't happen when using the mouse to invoke the menu because focus is shifted to the drop down so I think you just need to set the document's active element to the popup. |
@JeffryBooher I was able to fix the blur issue, was harder than expected since I couldn't focus almost any element, but bluing CodeMirror works. I added an extra bit to refocus CodeMirror if you close the menu using Escape, so you can open the menu, close it and keep coding. I also removed the toggle on Ctrl+Alt+R. Now it only opens the menu, and Esc closes it. |
Nominating for Sprint 31 |
@TomMalbran almost there... I think the navigation keys (Left/Right/Home/End/PgUp/PgDn) are still going to code mirror. I tried vairous other keys and it seems that blocking those keys is all that remains. |
Couple quick thoughts -- apologies if any of this already came up...
|
@peterflynn Thanks.
@JeffryBooher Those navigation keys where used on the body, but now with the focus fix, those keys shouldn't run on the sidebar. |
|
||
var $dropdownToggle, | ||
$dropdown; | ||
var KeyboardPrefs = JSON.parse(require("text!keyboard.json")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't used anywhere -- can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is actually used in line 423 to assign it to the keybinding.
@TomMalbran the edit keys are fixed there is one comment on a recent change (unused var) that needs to be fixed. |
|
||
showDropdown(); | ||
$dropdown.focus(); | ||
$dropdownItem = $dropdown.find("a").first(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by: looks like an indentation error here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent looks wrong on this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jinx :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to upgrade JSLint so that it starts shouting me about this stuff... hehe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't JSLint already complain about bad indentation normally? It sure does for me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't do for me. I would have seen this error if it did complained.
@TomMalbran About the global key hook... I think it's intended for use in cases where you're trying to override someone else's global capture handler. Since that's not needed here, and the focus location is better now, I think it's simplest to use a standard DOM listener (jQuery, really). The existing code you have up here, using the global key hook, seems like it will still work though. So if you'd rather get this merged now and do the cleanup later, that seems ok too. |
Fixed the indentation and keydown biding issues. I think is ready to merge now :) |
@TomMalbran Looks good to me! Anything more needed @JeffryBooher? Btw, just tested it out and I love it! It's soo nice being able to jump back to the previous project with just a quick "Ctrl+Alt+R, Enter" combo... |
Looks good @peterflynn ... Merging! Thanks @TomMalbran! |
Implementation of Navigate Recent Projects
As specified in the this Trello card,
CTRL+ALT+R
opens the recent project dropdown,up
anddown
moves to the next and previous item andenter
triggers a click event`on the currently selected item, which goes to the selected project or opens a new folder (if that item is selected).