-
Notifications
You must be signed in to change notification settings - Fork 974
keyboard shortcuts to move a tab left or right #11313
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11313 +/- ##
==========================================
- Coverage 52.6% 52.54% -0.07%
==========================================
Files 268 268
Lines 25237 25273 +36
Branches 4024 4031 +7
==========================================
+ Hits 13277 13280 +3
- Misses 11960 11993 +33
|
Thanks for providing the nice test plan (also automated tests code)! If automated tests should cover every possible scenarios, would you please add |
c7ece9b
to
3a8d0f9
Compare
app/localShortcuts.js
Outdated
electronLocalshortcut.register(win, 'Ctrl+Shift+PageDown', () => { | ||
const win = BrowserWindow.getFocusedWindow() | ||
if (win) { | ||
windowActions.tabMoveIncrementalRequested(win.id, true) |
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.
if moveNext
defaults to true
I think we can skip the second argument
js/stores/windowStore.js
Outdated
const sourceFrame = frameStateUtil.getActiveFrame(windowState) | ||
const isPinned = sourceFrame.get('pinnedLocation') | ||
const framesCanMoveWithin = isPinned ? frameStateUtil.getPinnedFrames(windowState) : frameStateUtil.getNonPinnedFrames(windowState) | ||
const frameGroupIdx = framesCanMoveWithin.indexOf(sourceFrame) |
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.
nit: I'd prefer the verbose name w/ frameGroupIndex
instead
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.
same for other similar named constants
test/lib/selectors.js
Outdated
@@ -7,7 +7,9 @@ module.exports = { | |||
activeTab: '[data-test-active-tab]', | |||
activeTabTitle: '[data-test-active-tab] [data-test-id="tabTitle"]', | |||
activeTabFavicon: '[data-test-active-tab] [data-test-favicon]', | |||
pinnedTabs: '.pinnedTabs', |
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.
can we make use of data
attr instead? something like data-pinned-tab
. We're trying to avoid tests w/ CSS selectors so Aphrodite changes could less likely break tests
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 - I had just copied what was there originally but makes sense to make the positive changes now
test/lib/selectors.js
Outdated
pinnedTabsTabs: '.pinnedTabs [data-test-id="tab"]', | ||
tabs: '.tabs', |
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.
same as above
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.
unable to test on macOS, left some comments
@petemill is this supposed to work on mac? if not please put OS specific labels. I guess not, given |
@cezaraugusto definitely for macOS. Works for me with |
3a8d0f9
to
29e33d7
Compare
@cezaraugusto addressed your feedback, rebased on master, and pushed replacement commit |
…order up or down one position. Fix brave#11310 Keyboard shortcut is ctrl-shift-pageup and ctrl-shift-pagedown Auditors: @bsclifton @cezaraugusto
29e33d7
to
fdfb0b5
Compare
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.
lgtm. Please just prefer using appConstants
instead of windowConstants
and move the windowAction
to the appAction
as well as we're moving in that direction. Please update tests too to reflect that.
I'm going to approve, once you make the changes please merge. great job!
@cezaraugusto changes you ask for cause the tests to fail as the window reducer never receives the action. I assume the problem is that the appStore won't forward the action to the window, since the action came from a window in the first place, and is targetted to one specific window? My assumption is because it works fine in the app, where the action is dispatched from the browser process, but in the tests, the action is dispatched from the window process using devTools('appActions'). Perhaps we can wait for the fuller refactor that has the appStore access to window state before trying to hack this in to work? Otherwise I can look at it again with clearer eyes. |
keyboard shortcuts to move a tab left or right
Fixes #11310
I created this PR as a precursor to some tab enhancements I'm working on with regard to sorting animation and realtime sorting operations during dragging. Following from this PR, which adds the command to change the sort order, I'll be able to submit the PR to add animation to the operation. These same shortcuts are present in other browsers by default (Firefox on all platforms, and Chrome on linux).
Keyboard shortcuts are:
ctrl-shift-pageup
: moves the current tab right, and the next tab left (swaps)ctrl-shift-pagedown
: moves the current tab left, and the previous tab right (swaps)Note that if you're on a mac keyboard with no pageup or pagedown keys, those are accessed via
fn-up
orfn-down
. So the shortcuts becomectrl-shift-fn-up
andctrl-shift-fn-down
Auditors:
@bsclifton
@cezaraugusto
Would be great to hear from you guys if the way this is architected is best practice. Thoughts I've had:
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
auto
npm run test -- --bail --grep="tab order index change"
manual
With one tab, one window
With multiple tabs, one window
With multiple tabs, two windows
With pinned tabs
With multiple tab pages
Reviewer Checklist:
Tests