-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add a resizeObserver to table cells to set cell height #862
Add a resizeObserver to table cells to set cell height #862
Conversation
When using slotted content in a table cell, it currently is not possible to set the content to be 100% of the cell. This is because using a slot takes the content our of the normal flow and it doesn't know what height it should use when set to 100%. By adding a resizeObserver to see the height of the cell and set that height manually, the descendant content can set height:100% and it will work as expected. While each cell will be set to it's own height, the nature of table rows means that all cells in a row will display as the height of the tallest cell, regardless of what height they have manually set.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this makes sense to disconnect after the work is done! Nice going.
🤔 Something it making it grow very slightly for each row - https://www.chromatic.com/test?appId=60919c26122bd50039b34644&id=679aa5fdfaecae4253b8e997 |
|
* feat(table): allow more complex data in table * chore(table): add changeset * feat(table): update table rowData tests * feat(table): add tests for content added via slot * feat(table): add test coverage for new elements * fix: revert unintended update to changelog * Add a resizeObserver to table cells to set cell height (#862) * fix(table): add resizeObserver to set cell height When using slotted content in a table cell, it currently is not possible to set the content to be 100% of the cell. This is because using a slot takes the content our of the normal flow and it doesn't know what height it should use when set to 100%. By adding a resizeObserver to see the height of the cell and set that height manually, the descendant content can set height:100% and it will work as expected. While each cell will be set to it's own height, the nature of table rows means that all cells in a row will display as the height of the tallest cell, regardless of what height they have manually set. * fix(table): account for border when calculating height
This change: (check at least one)
Is this a breaking change? (check one)
Is the: (complete all)
What does this change address?
It was impossible to set table cell content to fill the height of a cell. This allow that to happen.
How does this change work?
When using slotted content in a table cell, it currently is not possible to set the content to be 100% of the cell. This is because using a slot takes the content our of the normal flow and it doesn't know what height it should use when set to 100%. By adding a resizeObserver to see the height of the cell and set that height manually, the descendant content can set height:100% and it will work as expected.
While each cell will be set to it's own height, the nature of table rows means that all cells in a row will display as the height of the tallest cell, regardless of what height they have manually set.
Additional context
This is stacked on top of #840 for easier reviewing and will be merged into it before merging both change to develop at once