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

Vaadin should log a warning when EM units are used in a Grid column header #6849

Open
archiecobbs opened this issue Nov 21, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request vaadin-grid

Comments

@archiecobbs
Copy link

Description

After loading and displaying a new Grid, the column headers are not aligned with the columns themselves.

If you then grab one of the separators between the column headers and slide it left or right, the headers "snap" into their correct alignments.

Here's a video showing the problem:

VaadinBugVideo.mov

Expected outcome

The column headers should always be aligned with the columns themselves.

Minimal reproducible example

Please download and run this reproducer: https://github.com/archiecobbs/vaadin-grid-load-fail-issue/tree/column-alignment-issue

Note you have to checkout the column-alignment-issue branch.

Steps to reproduce

  1. Run git clone [email protected]:archiecobbs/vaadin-grid-load-fail-issue.git
  2. Run git checkout column-alignment-issue
  3. You need to have tomcat@10 installed via brew
  4. Run mvn clean package
  5. Run the script ./run.sh
  6. Connect to http://localhost:8080/example/example/

Environment

Vaadin version(s): 24.5.5
OS: MacOS 15.1.1

Browsers

Chrome

@rolfsmeds
Copy link
Contributor

Hi @archiecobbs, the issue you're seeing is caused by the use of em units in column widths. Because the font size on the header row is different from body rows, those sizes resolve to different pixel widths, thus misalignment.

As mention in the docs, you should use e.g. rem or px instead for column widths.

@rolfsmeds rolfsmeds added the waiting for author Further information is requested label Nov 28, 2024
@archiecobbs
Copy link
Author

archiecobbs commented Nov 29, 2024

Hi @archiecobbs, the issue you're seeing is caused by the use of em units in column widths.

Thanks for the hint @rolfsmeds !

But bleh... this is yet another obscure Vaadin booby trap. I've fallen into so many over the years...

So I'll change this bug to be a feature request - to log a warning (only once of course) in this situation.

Thanks.

@archiecobbs archiecobbs changed the title Grid column headers are not aligned with the columns themselves Vaadin should log a warning when EM units are used in a Grid column header Nov 29, 2024
@rolfsmeds
Copy link
Contributor

Yes, it's a very sneaky booby trap that you'll only be aware of in case you happen to read the javadoc or the Grid docs page on column width 😉

I'll recategorize this as a feature request then.

Oh, and suggestions of how to remove said booby trap are always welcome. Preferably ones that avoid introducing breaking changes affecting existing applications.

@rolfsmeds rolfsmeds added enhancement New feature or request and removed waiting for author Further information is requested labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vaadin-grid
Projects
None yet
Development

No branches or pull requests

3 participants