Skip to content
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

Prevent TablePaginator page buttons from being overlapped #2316

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

r100-stack
Copy link
Member

@r100-stack r100-stack commented Oct 25, 2024

Changes

After PR TODO from #2152.

The next button was not clickable after going to the next pages a few times because the right content was overlapping the page buttons. This overlap was happening because when the scrollWidth was increasing, the useOverflow() algorithm was not recalculating.

The best way would be to re-run the useOverflow() calculations when the scrollWidth changes. But that was not straightforward to do (thread).

So for now, I just went with giving the iui-center in the table paginator a higher z-index (#2316 (comment)). I also added an after-PR TODO to search for a better approach.

Old PR description subset that could be helpful when working on the better approach

I have been trying to find another way to trigger the useOverflow() re-calculations. E.g. moving the key inside OverflowContainerComponent from #2154:

const key =
`${itemsCount}` +
`${overflowOrientation === 'vertical' ? size?.height : size?.width}`;

I felt like doing that to keep similar code together and also so that other components that use OverflowContainer can also listen to their scrollWidth changes. However, I wasn't able to find a way that works well. Open to ideas for any improvements.

Testing

Could not think of a good way to test the overlapping. So, did not add any tests.

Before After
Before.mov
After.mov

Docs

Added one react changeset and one css changeset.

After PR TODOs

@r100-stack r100-stack self-assigned this Oct 25, 2024
@r100-stack r100-stack changed the title Prevent TablePaginator's center and right overlap Prevent TablePaginator page buttons from being overlapped Oct 25, 2024
@r100-stack r100-stack marked this pull request as ready for review October 28, 2024 19:16
@r100-stack r100-stack requested a review from a team as a code owner October 28, 2024 19:16
@r100-stack r100-stack requested review from mayank99 and smmr-dn and removed request for a team October 28, 2024 19:16
@r100-stack r100-stack enabled auto-merge (squash) November 4, 2024 00:39
@r100-stack r100-stack merged commit 1779daf into main Nov 4, 2024
18 checks passed
@r100-stack r100-stack deleted the r/table-paginator-right-button-not-working branch November 4, 2024 00:44
@imodeljs-admin imodeljs-admin mentioned this pull request Nov 4, 2024
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