Skip to content

DataViews: Enforce logical CSS properties with Stylelint - #87685

Merged
simison merged 2 commits into
trunkfrom
update/dataviews-stylelint-logical-css
Dec 2, 2026
Merged

simison merged 2 commits into
trunkfrom
update/dataviews-stylelint-logical-css

Conversation

@simison

@simison simison commented Nov 30, 2026

Copy link
Copy Markdown
Member

What?

Follow-up to #87663. Adds packages/dataviews/**/*.scss to the Stylelint override that requires logical CSS properties, and fixes the remaining violations it found.

Why?

#87663 moved DataViews to logical properties. Without the lint rule, physical properties can sneak back in unnoticed.

How?

  • tools/stylelint/config.js: add packages/dataviews/**/*.scss to the logical-CSS override and to the SCSS-only override (so scss/function-no-unknown is used instead of function-no-unknown).
  • margin: 0 0 X 0 → margin: 0 0 X in five group headers (grid, list, activity, picker-grid, picker-activity). Same computed value; the 3-value form doesn't name left/right, so it satisfies declaration-property-max-values.
  • scroll-padding-bottom → scroll-padding-block-end on the DataViews wrapper. Same result in horizontal writing modes.

No inline stylelint-disable comments or suppressions were needed.

Testing Instructions

  1. npm run lint:css passes.
  2. Add a physical property such as margin-left: 0; to any DataViews .scss file and check that npm run lint:css flags it.
  3. Optional: in Storybook, check that DataViews group headers (grid, list, activity, picker layouts) keep their bottom spacing.

Use of AI Tools

Drafted with Claude Code; reviewed by me.

@simison simison added [Type] Code Quality Issues or PRs that relate to code quality [Package] DataViews /packages/dataviews labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: simison <simison@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +18 B (0%)

Total Size: 8.73 MB

📦 View Changed
Filename Size Change
build/styles/edit-site/style-rtl.css 21.4 kB -2 B (-0.01%)
build/styles/edit-site/style-rtl.min.css 17.4 kB +2 B (+0.01%)
build/styles/edit-site/style.css 21.5 kB -3 B (-0.01%)
build/styles/edit-site/style.min.css 17.4 kB +2 B (+0.01%)
build/styles/editor/style-rtl.css 32.6 kB +4 B (+0.01%)
build/styles/editor/style-rtl.min.css 28.1 kB +6 B (+0.02%)
build/styles/editor/style.css 32.6 kB +4 B (+0.01%)
build/styles/editor/style.min.css 28.1 kB +5 B (+0.02%)

91c7de9 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f55cebd trunk % Change
timeToFirstByte 50.3 ms +3.18% -8.25% 48.7 ms +5.03% -3.08% 3.29%
largestContentfulPaint 80 ms +5% -5% 76 ms +7.89% -5.26% 5.26%
lcpMinusTtfb 29.25 ms +15.9% -8.03% 26.75 ms +17.01% -5.98% 9.35%
wpBeforeTemplate 25.4 ms +8.94% -4.72% 24.84 ms +8.41% -2.42% 2.25%
wpTemplate 19.4 ms +5.93% -5.98% 19.25 ms +5.09% -3.79% 0.78%
wpTotal 46.24 ms +2.94% -8.54% 44.51 ms +5.71% -3.17% 3.89%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f55cebd trunk % Change
timeToFirstByte 40.75 ms +3.56% -1.47% 41.65 ms +5.76% -4.32% -2.16%
largestContentfulPaint 72 ms +5.56% -0% 74 ms +5.41% -2.7% -2.7%
lcpMinusTtfb 32.2 ms +4.19% -2.48% 32.7 ms +3.52% -4.74% -1.53%
wpBeforeTemplate 22.25 ms +5.21% -0.45% 22.18 ms +2.3% -2.3% 0.32%
wpTemplate 14.97 ms +1.6% -3.54% 15.01 ms +3.6% -6.26% -0.27%
wpTotal 37.33 ms +3.56% -1.39% 37.82 ms +4.1% -4.07% -1.3%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f55cebd trunk % Change
mediaProcessingJpeg 344.31 ms +0.14% -1.21% 349.07 ms +0.58% -0.49% -1.36%
mediaProcessingAvif 5009.88 ms +0.2% -0.17% 5059.05 ms +0.57% -0.31% -0.97%
mediaProcessingJpegToAvif 3386.42 ms +0.02% -0.34% 3409.72 ms +0.54% -0.67% -0.68%

media-upload

Metric f55cebd trunk % Change
jpegUploadProcessing 1497.79 ms +2.03% -0.64% 1491.03 ms +0.38% -1.14% 0.45%
pngUploadProcessing 252.48 ms +1.89% -3.5% 242.73 ms +2.9% -1.46% 4.02%
largeJpegUploadProcessing 1461.96 ms +1.34% -0.2% 1463.52 ms +0.92% -0.24% -0.11%
multipleImageUploadProcessing 1560.34 ms +2.2% -0.57% 1570.41 ms +1.92% -1.1% -0.64%

post-editor

Metric f55cebd trunk % Change
serverResponse 293.15 ms +6.85% -9.03% 272.98 ms +6.76% -5.93% 7.39%
firstPaint 345.05 ms +3.02% -12.68% 275.36 ms +12.79% -4.03% 25.31%
domContentLoaded 616.15 ms +6.44% -3.17% 578.7 ms +3.88% -3.89% 6.47%
loaded 617.59 ms +6.45% -3.17% 580.03 ms +3.88% -3.9% 6.48%
firstContentfulPaint 351.14 ms +9.56% -2.38% 327.92 ms +2.8% -4.54% 7.08%
firstBlock 1665.49 ms +5.79% -1.93% 1574.58 ms +0.75% -2.09% 5.77%
type 16.68 ms +10.07% -8.87% 13.94 ms +4.59% -7.25% 19.66%
typeWithoutInspector 17.07 ms +3.81% -7.97% 14.36 ms +20.19% -3.48% 18.87%
typeWithTopToolbar 21.2 ms +4.1% -5.05% 17.98 ms +11.74% -6.79% 17.91%
typeContainer 7.55 ms +10.2% -6.36% 6.35 ms +4.88% -3.15% 18.9%
focus 91.55 ms +8.14% -7% 72.67 ms +8.46% -2.82% 25.98%
firstFocus 224.15 ms +0% -0% 187.53 ms +0% -0% 19.53%
selectAll 285.6 ms +4.05% -2.75% 262.71 ms +4.03% -5.79% 8.71%
undo 25.94 ms +6.63% -5.28% 23.1 ms +3.68% -2.38% 12.29%
listViewOpen 32.83 ms +9.38% -8.1% 28.34 ms +15.95% -7.94% 15.84%
inserterOpen 33.25 ms +4.69% -7.01% 30.83 ms +3.7% -5.74% 7.85%
inserterHover 9.59 ms +5.01% -7.51% 9.12 ms +4.93% -5.59% 5.15%
inserterSearch 7.68 ms +8.59% -9.51% 7.09 ms +4.94% -6.21% 8.32%
loadPatterns 458.18 ms +3.89% -5.88% 465.65 ms +8.95% -3.37% -1.6%
wpTotal 286.11 ms +6.61% -9.48% 265.81 ms +6.9% -6.2% 7.64%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f55cebd trunk % Change
serverResponse 409.49 ms +1.66% -8.53% 404.42 ms +1.92% -6.91% 1.25%
firstPaint 477.12 ms +4.77% -2.44% 406.71 ms +15.52% -8.62% 17.31%
domContentLoaded 854.9 ms +5.31% -1.79% 837.46 ms +0.67% -0.53% 2.08%
loaded 856.48 ms +5.31% -1.76% 838.94 ms +0.69% -0.51% 2.09%
firstContentfulPaint 490.98 ms +7.05% -5.05% 471.71 ms +0.77% -6.52% 4.09%
firstBlock 2581.79 ms +7.8% -1.14% 2542.61 ms +0.71% -0.88% 1.54%
type 18.08 ms +8.68% -6.75% 17.22 ms +4.12% -11.32% 4.99%
navigate 115.86 ms +6.1% -4.34% 107.8 ms +3.09% -3.89% 7.48%
loadPatterns 1645.61 ms +1.8% -10.83% 1479.89 ms +3.09% -2.76% 11.2%
loadPages 933.95 ms +2.24% -1.78% 910.65 ms +2.63% -1% 2.56%
wpTotal 398.82 ms +1.68% -8.79% 393.74 ms +1.95% -7.09% 1.29%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

91c7de9 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

As a user I want to be able to add multiple close buttons so that users can close the overlay from different positions in /test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js, passed after 1 failed attempt.
Error: expect(locator).toHaveCount(expected) failed

Locator:  getByRole('button', { name: 'Close' })
Expected: 2
Received: 1
Timeout:  5000ms

Call log:
  - Expect "toHaveCount" getByRole('button', { name: 'Close' }) with timeout 5000ms
  - waiting for getByRole('button', { name: 'Close' })
    14 × locator resolved to 1 element
       - unexpected value "1"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js:228:33
should have keyboard navigable link UI popover in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'URL' })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:966:28
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":22,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8891/wp-content/uploads/2026/12/0efaaca4-8ca1-48cd-b236-d0e08fa1f498.png" alt="" class="wp-image-22"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

91c7de9 Run

@aduth

aduth commented Nov 30, 2026

Copy link
Copy Markdown
Member

This seems fine and I wouldn't block it, but in my comment at #37411 (comment) I wondered if we shouldn't just go further and enable the logical-css rule everywhere and mark all existing issues as suppressed via bulk suppressions.

@simison

simison commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

We can merge this already to make DataViews clean for these rules, since the PR also includes fixes.

I made a PR for the bulk suppressions:

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

A couple of things for #87686, assuming this one lands first:

  • Its suppressions file still has entries for the six DataViews violations fixed here. Stylelint won't fail on them, but could you rerun npm run lint:css:update-suppressions after rebasing so they get pruned?
  • Once the logical rules move to the top level, the packages/dataviews/**/*.scss entries added here will only keep the CSS-modules rules (property-no-unknown with composes, :global, and the Baseline function-no-unknown). Could #87686 either drop them or keep them on purpose?

@simison
simison force-pushed the update/dataviews-stylelint-logical-css branch from a441018 to 7916a65 Compare November 30, 2026 21:21
Add packages/dataviews/**/*.scss to the logical-css Stylelint override so physical properties don't creep back in after #87663, and fix the remaining violations.
@simison
simison force-pushed the update/dataviews-stylelint-logical-css branch from 7916a65 to 91c7de9 Compare December 2, 2026 10:35
@simison
simison enabled auto-merge (squash) December 2, 2026 10:35
@simison
simison merged commit 77a66d7 into trunk Dec 2, 2026
84 checks passed
@simison
simison deleted the update/dataviews-stylelint-logical-css branch December 2, 2026 10:54
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] DataViews /packages/dataviews [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants