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

position:absolute doesn't work for tables #221

Closed
barotto opened this issue Aug 17, 2021 · 2 comments
Closed

position:absolute doesn't work for tables #221

barotto opened this issue Aug 17, 2021 · 2 comments
Labels
layout Layout engine issues and enhancements

Comments

@barotto
Copy link
Contributor

barotto commented Aug 17, 2021

Opening this issue following a discussion on gitter.

When an element with display:table; also has position:absolute; then any children element with table-related display values like table-row or table-cell inside of it will generate the following error:

Element has a display type 'table-row', but is not located in a table. It will not be formatted.

I don't have much experience with the source code, but this problem appears to happen because when a table has absolute position it's added as such in the block_context_box object at LayoutEngine.cpp:157 but the LayoutTable::FormatTable() function won't be called in the CloseAbsoluteElements() called at LayoutEngine.cpp:94

As a workaround you can put a table inside a div element set with position:absolute;

mikke89 added a commit that referenced this issue Aug 17, 2021
…y positioned, as this is currently not supported. See #221.
@mikke89
Copy link
Owner

mikke89 commented Aug 17, 2021

Thanks! I figured this also happens with floated tables.

You're on the right track there. I managed to hack some solution together, but really it needs some more structural changes to handle this properly. And I don't think it's worth spending too much time on that right now. Instead, I figured the best course of action is to warn and provide the suggested workaround to the user.

@mikke89 mikke89 added the layout Layout engine issues and enhancements label Aug 20, 2021
@mikke89
Copy link
Owner

mikke89 commented Aug 20, 2021

I'm closing this for now with the improved warnings and workarounds. I suspect this might be an issue with flexboxes as well when they are ready, so we might want to revisit this issue then for a proper fix.

@mikke89 mikke89 closed this as completed Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layout Layout engine issues and enhancements
Projects
None yet
Development

No branches or pull requests

2 participants