Marking files as "Viewed" with keyboard shortcut #10197
Replies: 11 comments 9 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
I guess it could be built a browser extension |
Beta Was this translation helpful? Give feedback.
-
|
I agree. There is a huge lack of support for proper navigation using a keyboard only. Come on Github, this a programming website. |
Beta Was this translation helpful? Give feedback.
-
|
I second this, it'd help ergonomics for the masses and accessibility for those in need |
Beta Was this translation helpful? Give feedback.
-
|
👍 I'd really like to be able to fully navigate code reviews with only my keyboard, but it's impossible ATM. |
Beta Was this translation helpful? Give feedback.
-
|
For those who want to use it now, here is a script that gives you the ability. if (window.disposeMarkAsViewedByEscape) {
window.disposeMarkAsViewedByEscape()
}
window.disposeMarkAsViewedByEscape = start()
function start() {
window.addEventListener('keydown', handleKeyDown)
return ()=>{
window.removeEventListener('keydown', handleKeyDown)
}
function markFileAsViewed() {
const fileElement = document.querySelector(`[data-details-container-group="file"]:hover`)
if(fileElement){
const fileViewedCheckbox = fileElement.querySelector(`.js-reviewed-checkbox`)
fileViewedCheckbox?.click()
}
}
function handleKeyDown() {
if (event.key === 'Escape') {
markFileAsViewed()
}
}
}The UX almost the same as in Slack Unreads section where you have an ability to mark chat as read. The subsequent Escape also clicks the "Viewed" button unmarking it. You can inject the script to the page in any way that you prefer from Tampermonkey to Keyboard Maestro and others. |
Beta Was this translation helpful? Give feedback.
-
|
Came up with pretty cool tool // Right-click on a code section to mark a file as viewed
document.addEventListener('contextmenu', function(ev) {
ev.preventDefault();
const closestFile = ev.target.closest('.js-details-container');
if (closestFile) {
const checkbox = closestFile.querySelector('.js-reviewed-checkbox');
if (checkbox) {
checkbox.click();
}
}
return false;
}, false);Use this to make all "Click to load code" buttons expand document.querySelectorAll('.load-diff-button').forEach(b => b.click()); |
Beta Was this translation helpful? Give feedback.
-
|
There's also an open suggestion for Refined GitHub extension: refined-github/refined-github#5674 The extension already adds keyboard shortcuts for PR navigation, so it could be extended to mark files as viewed. |
Beta Was this translation helpful? Give feedback.
-
|
Why is that not part of GitHub proper? At least when you submit your review it could mark all as viewed |
Beta Was this translation helpful? Give feedback.
-
|
Ergonomics are very poor indeed ... |
Beta Was this translation helpful? Give feedback.
-
|
I've been using this approach in a bookmarklet (but should also work in user script), works with and without the new review experience enabled, and tries to minimize need for mouse use/scrolling: https://gist.github.com/bregenspan/bf0e9706df5b675112a7e954aba6f9ae |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Would be nice instead of going up and clicking the checkbox. Also would go nicely with up/down and/or left/right and/or j/k for going between files
Beta Was this translation helpful? Give feedback.
All reactions