Bug Description
If the cell you wish to focus on is already active but not visible, the spreadsheet doesn't scroll to the cell, making the cell focus button appear unresponsive.
Sheet.setActiveSelection does not scroll to the active selection if the selection is already active but not visible on-screen.
Small sample script that reliably reproduces the issue
The sample should run as-is or with minimal setup, without external
dependencies.
function scrollBug() {
SpreadsheetApp.getActiveSheet().setActiveSelection("X470");
};
Steps to Reproduce Behavior
Create a new spreadsheet. You don't need to enter any data, fine to leave empty.
Run scrollBug function defined above from script editor. Notice that the active cell is now X470 and it is visible on-screen (as expected).
Without changing the active cell, scroll in the spreadsheet so that cell X470 isn't visible on-screen anymore.
Run scrollBug function again. Notice that the active cell is still X470 but isn't visible on-screen (scrolling didn't happen).
Expected Behavior
I'd expect to see step 4 (above) scroll so that cell X470 is visible on-screen, even if that cell is already active. Instead, cell X470 is active but not visible on-screen.
Comments
Project key (found under "File > Project properties"):
MmODIcgMH45sSC8x3kMR-IdNe5WnWB3vw
Bug Description If the cell you wish to focus on is already active but not visible, the spreadsheet doesn't scroll to the cell, making the cell focus button appear unresponsive. Sheet.setActiveSelection does not scroll to the active selection if the selection is already active but not visible on-screen.
Small sample script that reliably reproduces the issue The sample should run as-is or with minimal setup, without external dependencies.
function scrollBug() { SpreadsheetApp.getActiveSheet().setActiveSelection("X470"); };
Steps to Reproduce Behavior
Expected Behavior I'd expect to see step 4 (above) scroll so that cell X470 is visible on-screen, even if that cell is already active. Instead, cell X470 is active but not visible on-screen.
Comments Project key (found under "File > Project properties"): MmODIcgMH45sSC8x3kMR-IdNe5WnWB3vw