Prevent TablePaginator
page buttons from being overlapped
#2316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, theuseOverflow()
algorithm was not recalculating.The best way would be to re-run the
useOverflow()
calculations when thescrollWidth
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 thekey
inside OverflowContainerComponent from #2154:iTwinUI/packages/itwinui-react/src/utils/components/OverflowContainer.tsx
Lines 113 to 115 in 528cf54
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.mov
After.mov
Docs
Added one react changeset and one css changeset.
After PR TODOs