Skip to content

Commit b992c99

Browse files
committed
Trello: Add a shift+m keyboard shortcut to quickly move a card.
1 parent 2101156 commit b992c99

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

TrelloA11yFixes.user.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,37 @@ var observer = new MutationObserver(function(mutations) {
8888
});
8989
observer.observe(document, {childList: true, attributes: true,
9090
subtree: true, attributeFilter: ["class"]});
91+
92+
function moveCard() {
93+
// Open the quick editor.
94+
var op = document.querySelector(".active-card .list-card-operation");
95+
if (!op) {
96+
return;
97+
}
98+
op.click();
99+
// Click the Move button.
100+
var move = document.querySelector(".js-move-card");
101+
if (!move) {
102+
return;
103+
}
104+
move.click();
105+
// Focus the list selector.
106+
// This doesn't work if we don't delay it. Not quite sure why.
107+
setTimeout(function() {
108+
var sel = document.querySelector(".js-select-list");
109+
if (!sel) {
110+
return;
111+
}
112+
sel.focus();
113+
}, 50);
114+
}
115+
116+
// Add some keyboard shortcuts.
117+
document.addEventListener("keydown", function(evt) {
118+
if (document.activeElement.nodeName == "INPUT" || document.activeElement.isContentEditable) {
119+
return false;
120+
}
121+
if (evt.key == "M") {
122+
moveCard();
123+
}
124+
});

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,4 @@ It does the following:
9797
- Labels badges in cards.
9898
- Makes list headers accessible as headings.
9999
- Prevents loss of position for screen reader users when pressing the control key.
100+
- Adds a shift+m keyboard shortcut to quickly move a card.

0 commit comments

Comments
 (0)