Table rows invisible when scrolling a table anchored part way down a document
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start in array-virtual-repeat-strategy.ts at getViewRange and inspect how getDistanceToParent and topBufferDistance are used. Reproduce the table inside a fixed-height scroll container, anchored part way down a Shadow DOM document, then compare scrolling with the reported zeroed buffer distance. Done means rows remain visible while scrolling regardless of the table's distance from the document top.
Written by the indexing model from the issue text.
Description
I'm submitting a bug report
- Library Version:
1.0.0-beta.7
Please tell us about your environment:
-
Operating System:
Win 10 -
Node Version:
10.16.2 -
NPM Version:
6.9.0 -
Webpack Version
webpack 4.41.6 -
Browser:
Chrome 81.0.4044.113 (Official Build) (64-bit) -
Language:
TypeScript 3.6.4
Use Case
I put virtual-repeat.for on a tr element inside a table. The table is inside a scroll container which is inside a custom element using Shadow DOM.
<custom-element>//attached somewhere down the page
<shadow-root>
<controls></controls>//other elements in here
<scroll-container>//has overflow: auto; and a fixed height
<table>
<tbody>
<tr virtual-repeat.for="row of rows">
<td><div>nested stuff here</div></td>
</tr>
</tbody>
</table>
</scroll-container>
<shadow-root>
</custom-element>
Current behavior:
Everything works fine with the element anchored to the top of the document. However, scrolling breaks when anchoring the element part way down the page. The farther down the document a table is anchored, and the more a user scrolls down the table, the more rows are hidden and replaced with blank space. Increasing the height of the scroll container proportionally to the anchor distance from the top of the document mitigates the problem.
I tried using fixed row heights with no change in behaviour. Zooming in/out changes the number of rows that become invisible.
Expected/desired behavior:
Rows should scroll into view, even when the table isn't anchored to the top of the page.
Fix
I got the plugin working perfectly for my use case by cloning the ui-virtualization plugin and editing the function getViewRange in file array-virtual-repeat-strategy.ts.
const topBufferDistance = 0;//getDistanceToParent(topBufferEl, scrollerEl);
You can see the helper function that I zeroed out. That function's probably important for something, but replacing it with a zero seems to fix the bug.
- Dominant language
- TypeScript
- Stars
- 88
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aurelia/ui-virtualization
-
Slow ScrollOpen
Difficulty 4/5 3-5 days Newbie friendliness 30/100
aurelia/ui-virtualization#247 · 3 comments ·
-
question
Difficulty 1/5 Under an hour Newbie friendliness 45/100
aurelia/ui-virtualization#243 · 7 comments ·
-
question
Difficulty 3/5 1-2 days Newbie friendliness 35/100
aurelia/ui-virtualization#172 · 5 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
aurelia/ui-virtualization#125 · 5 comments · 8 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
aurelia/ui-virtualization#124 · 3 reactions ·
All issues in aurelia/ui-virtualization
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
🎙️ task - drop the raw `./node_modules/.bin/rhachet roles boot` line from bhuild's feedback templateOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ehmpathy/rhachet-roles-bhuild#639 ·
Maintainers usually reply within 1 day
-
e2e-failure ready-to-code
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
redhat-developer/rhdh-plugin-export-overlays#4650 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 13 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
omdsh-dev/DSH-better-sidebar#1098 ·
Maintainers usually reply within 2 days