-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Avoid trying to scroll right when focusing a cell in the last column if 100% in viewport #2104
Conversation
@dtassone for me the issue was that So we add a My fix reduces the With that being said, if their are valid cases where we want to show these empty cells with more than 0px of width but less that 20px of width, then we should edit their padding because the current behavior do not handle it correctly. If we just remove the padding, it would be quite clean for #2013 but not on #2011 because of the border on the cells. But I have probably broken something else on the table you screen, I'll check EDIT : I'm not reproducing your screenshot. Could you add a video and the link please ? |
I did a small investigation about this bug in #2103 (comment). I think we can take a different direction to fix it, because the problem is not the empty cell. Not that we shouldn't remove the empty cell, but the problems is not it. 😛 |
OK so from what I understand there are several issues here. I think that Grid with at least 1 flex column should always have a total column width a least equal to the viewport width. Unless there is a better solution to avoid this gap problem : #2011 (comment) I did reproduce your video @dtassone. I'll implement @m4theushw 's fix from #2103 (comment) |
@m4theushw do you see a difference here https://github.com/mui-org/material-ui-x/pull/2104/files#diff-1c5bf15ff6f5b30287003a45d20a597797db104b7edab8d778f00e96f2dc06c1R97 Between : if (
lastColIndex < positions.length - 1 ||
(positions[positions.length - 1] && totalWidth > availableWidth)
) {
lastColIndex -= 1; // Last fully visible column
} and const lastColumnRightPosition = positions[lastColIndex] + visibleColumns[lastColIndex].width
if (
lastColIndex < positions.length - 1 ||
(positions[positions.length - 1] && lastColumnRightPosition > availableWidth)
) {
lastColIndex -= 1; // Last fully visible column
} For me they are equivalent (and the 1st is lighter) but I'm not sure. I did the 1st one and it fixes the video above |
Yeah, they seem to be equivalent. I think the solution is around improving this while-loop. This last decrement we do doesn't seem right. But I'm OK if we need an extra logic checking if we're at the last column. |
@m4theushw I reworked the |
I have done a quick exploration in #2162 for another issue. It seems to solve this one even if it wasn't the intent. Two birds 🕊 with one stone 🗿. |
I was wrong; I have posted a new comment on why in #2103 |
Part of #2103 (followed by #2110)