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

feat(Table): add Th (header) width attribute for tables with fixed layout #3590

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented May 22, 2024

No description provided.

Copy link

vercel bot commented May 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2024 9:58am

@tujoworker tujoworker changed the title feat(Table): add Th (header) width attribute support for fixed ta… feat(Table): add Th (header) width attribute support for fixed tables May 22, 2024
@tujoworker tujoworker changed the title feat(Table): add Th (header) width attribute support for fixed tables feat(Table): add Th (header) width attribute for fixed tables May 22, 2024
@tujoworker tujoworker changed the title feat(Table): add Th (header) width attribute for fixed tables feat(Table): add Th (header) width attribute for tables with fixed layout May 22, 2024
Copy link

codesandbox-ci bot commented May 22, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@tujoworker tujoworker force-pushed the fix/table-accoridon-width branch 2 times, most recently from 1b0e2d3 to 019f695 Compare May 30, 2024 08:59
@tujoworker tujoworker requested a review from snorrekim May 30, 2024 08:59
@tujoworker tujoworker marked this pull request as ready for review May 30, 2024 09:36
@snorrekim
Copy link
Contributor

snorrekim commented May 30, 2024

Turns out the width attribute is deprecated and it only supports percentage and px in chrome at the moment, not rem or em. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#width

We might have to use css style={{width: "25%"}}

Also, we can avoid the small width change on expand if we leave 1 column to be "free". Since there is a hidden column for the expand icon, the total widths adds up to more than 100%, and we can't predict the percentage. But if one column doesn't have a width, it will fill the rest. Basically, any total width above 100% seems to be handled like a non-fixed table, so it changes when expanding.

Though we should probably change the example to be more useful. Most real tables will have at least one column that can be flexible.

Copy link
Contributor

@snorrekim snorrekim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use css width style instead, as that supports more units and isn't deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants