Commit 6f0e5ed6 authored by Nathan Friend's avatar Nathan Friend

Don't apply Ctrl+P MR shortcut on Mac

This commit updates the "Go to file" keyboard shortcut to only be
applied with the correct modifier for the current platform
(⌘ for Mac, Ctrl otherwise).
parent 966172b9
......@@ -128,7 +128,7 @@ export default {
this.focusedIndex = 0;
}
Mousetrap.bind(['t', 'command+p', 'ctrl+p'], e => {
Mousetrap.bind(['t', 'mod+p'], e => {
if (e.preventDefault) {
e.preventDefault();
}
......@@ -142,7 +142,7 @@ export default {
el.classList.contains('inputarea')
) {
return true;
} else if (combo === 'command+p' || combo === 'ctrl+p') {
} else if (combo === 'mod+p') {
return false;
}
......
---
title: Stop applying Ctrl+P shortcut on MR page on Mac
merge_request: 42240
author:
type: fixed
......@@ -319,8 +319,8 @@ describe('File finder item spec', () => {
.catch(done.fail);
});
it('calls toggle on `command+p` key press', done => {
Mousetrap.trigger('command+p');
it('calls toggle on `mod+p` key press', done => {
Mousetrap.trigger('mod+p');
vm.$nextTick()
.then(() => {
......@@ -330,33 +330,12 @@ describe('File finder item spec', () => {
.catch(done.fail);
});
it('calls toggle on `ctrl+p` key press', done => {
Mousetrap.trigger('ctrl+p');
vm.$nextTick()
.then(() => {
expect(vm.toggle).toHaveBeenCalled();
})
.then(done)
.catch(done.fail);
});
it('always allows `command+p` to trigger toggle', () => {
expect(
Mousetrap.prototype.stopCallback(
null,
vm.$el.querySelector('.dropdown-input-field'),
'command+p',
),
).toBe(false);
});
it('always allows `ctrl+p` to trigger toggle', () => {
it('always allows `mod+p` to trigger toggle', () => {
expect(
Mousetrap.prototype.stopCallback(
null,
vm.$el.querySelector('.dropdown-input-field'),
'ctrl+p',
'mod+p',
),
).toBe(false);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment