Skip to content

Conversation

@vursen
Copy link
Contributor

@vursen vursen commented Nov 10, 2025

Description

The PR fixes a bug where the grid didn't take into account the scrollbar width when scrolling a cell into view horizontally.

Finding from #10464

Type of change

  • Bugfix

@vursen vursen marked this pull request as ready for review November 10, 2025 14:10
Base automatically changed from add-more-grid-focus-visual-tests to main November 10, 2025 14:22
@vursen vursen force-pushed the fix-grid-horizontal-scrolling branch from 8d7f0a8 to 625baab Compare November 10, 2025 14:24
Comment on lines 1018 to 1019
let leftBoundary = this.$.table.getBoundingClientRect().left;
let rightBoundary = leftBoundary + this.$.table.clientWidth;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to also have a unit test. Also, visual tests seem to only cover LTR mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks! Addressed the RTL mode and added tests.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 11, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

}

dstCell.focus();
dstCell.focus({ preventScroll: true });
Copy link
Contributor Author

@vursen vursen Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prevents false positive test results, as some browsers scroll here to compensate for the issue, but this behavior isn't consistent and doesn't seem to work in RTL mode.

launchOptions: {
channel: 'chrome',
headless: true,
ignoreDefaultArgs: ['--hide-scrollbars'],
Copy link
Contributor Author

@vursen vursen Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes scrollbars visible in headless mode.


if (dstCellRect.left < leftBoundary) {
this.$.table.scrollLeft += Math.round(dstCellRect.left - leftBoundary);
this.$.table.scrollLeft += dstCellRect.left - leftBoundary;
Copy link
Contributor Author

@vursen vursen Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rounding caused an underscroll in RTL mode: -0.5 VS 0

flushGrid(grid);

// Force reflow to workaround a Safari rendering issue
if (isDesktopSafari) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: tested and this code added back in #3605 is still needed in both Safari 18 and 26 used by Playwright.

@vursen vursen merged commit bc6d867 into main Nov 11, 2025
9 checks passed
@vursen vursen deleted the fix-grid-horizontal-scrolling branch November 11, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants