Skip to content

Conversation

@vursen
Copy link
Contributor

@vursen vursen commented Nov 13, 2025

Description

The PR replaces attribute selectors such as [part~='header'] with class selectors like .header in the grid component's CSS stylesheets. This change noticebly improves performance in large complex grids by reducing style recalculation cost.

Base styles (selector stats)

Before ~1.7M

Screenshot 2025-11-13 at 14 12 09

After ~660K

Screenshot 2025-11-13 at 14 15 53

Base styles

~35% improvement in render time:

Before After
Screenshot 2025-11-13 at 14 06 18 Screenshot 2025-11-13 at 13 52 27

Aura

~32% improvement in render time:

Before After
Screenshot 2025-11-13 at 14 04 04 Screenshot 2025-11-13 at 13 55 19

Lumo

~17% improvement in render time:

Before After
Screenshot 2025-11-13 at 14 04 47 Screenshot 2025-11-13 at 13 52 57

(All measurements are taken on a page with 60-column heavy grid)

Type of change

  • Refactor

@vursen vursen force-pushed the switch-from-parts-to-classes branch from d08ec8b to b8c7aa8 Compare November 13, 2025 11:25
@vursen vursen force-pushed the switch-from-parts-to-classes branch from 7927f77 to 7feb1a2 Compare November 13, 2025 12:04
@sonarqubecloud
Copy link

@vursen vursen changed the title refactor: switch from part attribute to class CSS selectors in grid refactor: switch from part attribute to class selectors in grid Nov 13, 2025
@vursen vursen marked this pull request as ready for review November 13, 2025 12:34
<tbody id="emptystatebody">
<tr id="emptystaterow">
<td part="empty-state" id="emptystatecell" tabindex="0">
<td part="empty-state" class="empty-state" id="emptystatecell" tabindex="0">
Copy link
Contributor Author

@vursen vursen Nov 13, 2025

Choose a reason for hiding this comment

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

I had to add a class because switching Lumo to use #emptystatecell would affect the selector specificity...

@web-padawan web-padawan merged commit 2b1ac6a into main Nov 14, 2025
9 checks passed
@web-padawan web-padawan deleted the switch-from-parts-to-classes branch November 14, 2025 07:49
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 25.0.0-beta6.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants