Commit f8cf223c authored by Mike Greiling's avatar Mike Greiling

Merge branch 'nfriend-dont-apply-ctrl-p-on-mac' into 'master'

Don't apply Ctrl+P MR keyboard shortcut on Mac

See merge request gitlab-org/gitlab!42240
parents 40c6f109 6f0e5ed6
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
this.focusedIndex = 0; this.focusedIndex = 0;
} }
Mousetrap.bind(['t', 'command+p', 'ctrl+p'], e => { Mousetrap.bind(['t', 'mod+p'], e => {
if (e.preventDefault) { if (e.preventDefault) {
e.preventDefault(); e.preventDefault();
} }
...@@ -142,7 +142,7 @@ export default { ...@@ -142,7 +142,7 @@ export default {
el.classList.contains('inputarea') el.classList.contains('inputarea')
) { ) {
return true; return true;
} else if (combo === 'command+p' || combo === 'ctrl+p') { } else if (combo === 'mod+p') {
return false; 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', () => { ...@@ -319,8 +319,8 @@ describe('File finder item spec', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls toggle on `command+p` key press', done => { it('calls toggle on `mod+p` key press', done => {
Mousetrap.trigger('command+p'); Mousetrap.trigger('mod+p');
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
...@@ -330,33 +330,12 @@ describe('File finder item spec', () => { ...@@ -330,33 +330,12 @@ describe('File finder item spec', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls toggle on `ctrl+p` key press', done => { it('always allows `mod+p` to trigger toggle', () => {
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', () => {
expect( expect(
Mousetrap.prototype.stopCallback( Mousetrap.prototype.stopCallback(
null, null,
vm.$el.querySelector('.dropdown-input-field'), vm.$el.querySelector('.dropdown-input-field'),
'ctrl+p', 'mod+p',
), ),
).toBe(false); ).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