Skip to content

Commit 340fdd9

Browse files
committed
Google Keep: Make alt+enter open a link if a link bubble is shown.
1 parent 61e6a79 commit 340fdd9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

GoogleKeepA11yFixes.user.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,22 @@ function init() {
139139
const LOAD_TWEAKS = [
140140
// Set role="application" because the most efficient way to
141141
// navigate Google Keep is with keyboard shortcuts and browse mode makes that
142-
// harder.
142+
// harder. Also handle certain key presses.
143143
{selector: 'body',
144-
tweak: el => el.setAttribute("role", "application")},
144+
tweak: el => {
145+
el.setAttribute("role", "application");
146+
el.addEventListener("keydown", evt => {
147+
// Make alt+enter open a link if a link bubble is shown.
148+
if (evt.key == "Enter" && evt.altKey) {
149+
evt.preventDefault();
150+
evt.stopPropagation();
151+
const openLink = document.querySelector(".IZ65Hb-hSRGPd-V68bde-hSRGPd");
152+
if (openLink && openLink.clientWidth > 0) {
153+
openLink.click();
154+
}
155+
}
156+
}, { capture: true });
157+
}},
145158
];
146159

147160
// Attributes that should be watched for changes and cause dynamic tweaks to be

0 commit comments

Comments
 (0)