How ChatGPT Fixed ChatGPT: Enabling Page Down And Page Up Support
I don’t know if anyone else has this problem, but when I use ChatGPT in Chrome, I can’t use Page Up / Page Down / End and Home keys, they just don’t work.
It is quite frustrating because when you have a long ChatGPT conversation, it makes it tedious to scroll it. Especially when I use it for some coding assistance, etc. Usually my chats become quite long quite fast.
But today was the day I decided I have to fix it. Obviously, to do it, I asked ChatGPT for an assistance. What I did, I copied a section of a new chat that contained scrollbar, but wasn’t too long, and pasted it into ChatGPT. I’ve asked it also to fix the issue.
To do it, I used o1-mini model, because it’s faster than 4o and I feel a little bit better with coding tasks.
Anyways, it spew out some script:
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('keydown', function(event) {
// Check if Page Up or Page Down was pressed
if (event.key === 'PageDown' || event.key === 'PageUp') {
event.preventDefault(); // Prevent the default page scrolling
// Identify the scrollable container
const scrollContainer = document.querySelector('.react-scroll-to-bottom--css-qvfmh-79elbk');
if (scrollContainer) {
// Define the scroll amount (e.g., window height)
const scrollAmount = window.innerHeight;
if (event.key === 'PageDown') {
// Scroll down
scrollContainer.scrollBy({
top: scrollAmount,
behavior: 'smooth' // Smooth scrolling
});
} else if (event.key === 'PageUp') {
// Scroll up
scrollContainer.scrollBy({
top: -scrollAmount,
behavior: 'smooth'
});
}
} else {
// If a specific container is not found, scroll the entire window
if (event.key === 'PageDown') {
window.scrollBy({
top: window.innerHeight,
behavior: 'smooth'
});
} else if (event.key === 'PageUp') {
window.scrollBy({
top: -window.innerHeight,
behavior: 'smooth'
});
}
}
}
});
});
I’ve just pasted it into Run JavaScript extension, that still works in Chrome, but Chrome shows a sh***ty message it may stop working. That day I will just ditch Chrome for good, because how essential this extension is for me.
(BTW. If you download it, remember to audit it)
Anyways, yeah, the script works. When you do it, you can use Page Down, Page Up, Home and End like in every normal app.
And this is the case where ChatGPT fixed itself. Cheers!