Skip to content

fix(components): [table] lingering row background when layout changes#23961

Merged
btea merged 2 commits into
devfrom
fix/23955
Apr 2, 2026
Merged

fix(components): [table] lingering row background when layout changes#23961
btea merged 2 commits into
devfrom
fix/23955

Conversation

@rzzf
Copy link
Copy Markdown
Member

@rzzf rzzf commented Apr 1, 2026

This appears to be an issue related to how Chrome handles both hover behavior and transitions after layout shifts. In Safari, after clicking a button, the hover effect remains on the button even if the cursor is already over a new row; in Chrome, the behavior is the opposite. Interestingly, the transition effect itself lingers.

Inspecting the computed background-color in DevTools shows the expected value #fff, but what is actually rendered is a lingering transition between the hover color and #fff.

If transition-duration is set to 0 or the transition is removed, the issue disappears. I'm not entirely sure why this happens, but a practical workaround is to introduce a very small transition-delay, which also resolves the issue.

You can try adjusting the transition-duration locally to observe this behavior. I'm not sure why the issue disappears after modifying the row’s background-color in the playground.

Source Code
  @include m(enable-row-transition) {
    .#{$namespace}-table__body td.#{$namespace}-table__cell {
      transition: background-color 1s ease;
    }
  }

  @include m(enable-row-hover) {
    .#{$namespace}-table__body tr:hover > td.#{$namespace}-table__cell {
      background-color: red;
    }
  }

fix #23955

demo

Summary by CodeRabbit

  • Style
    • Refined table row background-color transition by adding a tiny delay to make row state changes feel smoother and more visually consistent during interactions (e.g., hover, selection), reducing flicker on quick transitions.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ace127ef-6820-4add-a362-1afb6736a634

📥 Commits

Reviewing files that changed from the base of the PR and between 4f22d01 and 4196c8a.

📒 Files selected for processing (1)
  • packages/theme-chalk/src/table.scss
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme-chalk/src/table.scss

📝 Walkthrough

Walkthrough

A single CSS change in packages/theme-chalk/src/table.scss: the transition for .#{namespace}-table__body td.#{namespace}-table__cell under enable-row-transition was modified to add a 1ms delay to the background-color transition.

Changes

Cohort / File(s) Summary
Table Hover Transition Fix
packages/theme-chalk/src/table.scss
Changed transition: background-color 0.25s ease; to transition: background-color 0.25s ease 1ms; within the enable-row-transition modifier for table body cells to introduce a 1ms delay and address persistent hover rendering.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

Needs Review

Suggested reviewers

  • btea

Poem

🐰 A tiny 1ms hop, a quiet, clever trick,
Hover ghosts now vanish — gone with just a click.
I nudge the colors' dance with barely any time,
And rows return to calm, in rhythm and in rhyme.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description lacks a comprehensive structure following the template. While it provides technical context and references issue #23955, it does not include explicit checklist items confirming compliance with contributing guidelines, branch verification, or standard PR documentation practices. Add the standard checklist items from the template to confirm compliance with contributing guidelines, branch targeting, and issue references in a structured format.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing a lingering row background transition issue in el-table when layout changes occur, which directly corresponds to the SCSS modification.
Linked Issues check ✅ Passed The PR directly addresses issue #23955 by adding a 1ms transition-delay to the background-color transition on table cells, which resolves the lingering hover state issue after layout shifts and matches the expected fix described in the issue.
Out of Scope Changes check ✅ Passed The change is minimal and focused: only a single SCSS rule modification adding transition-delay to fix the reported hover lingering issue, with no unrelated alterations to other components or functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/23955

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 1, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus@23961
npm i https://pkg.pr.new/element-plus@23961
yarn add https://pkg.pr.new/[email protected]

commit: 4196c8a

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Size Change: +3 B (0%)

Total Size: 1.46 MB

📦 View Changed
Filename Size Change
dist/element-plus/dist/index.css 46.8 kB +3 B (+0.01%)
ℹ️ View Unchanged
Filename Size
dist/element-plus/dist/index.full.js 429 kB
dist/element-plus/dist/index.full.min.js 285 kB
dist/element-plus/dist/index.full.min.mjs 278 kB
dist/element-plus/dist/index.full.mjs 420 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 85.58% 18181 / 21242
🔵 Statements 84.37% 19028 / 22551
🔵 Functions 83.48% 4843 / 5801
🔵 Branches 74.15% 10531 / 14202
File CoverageNo changed files found.
Generated in workflow #2181

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

🧪 Playground Preview: https://element-plus.run/?pr=23961
Please comment the example via this playground if needed.

Copy link
Copy Markdown
Member

@keeplearning66 keeplearning66 left a comment

Choose a reason for hiding this comment

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

If you use div tags directly instead of table, this issue doesn't occur, which is a bit strange. demo However, the current solution does indeed resolve the problem. 👍

Copy link
Copy Markdown
Member

@btea btea left a comment

Choose a reason for hiding this comment

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

It seems more like a problem with the browser's rendering of composite layers under specific circumstances. The current fix appears to be quite reasonable and effective. 👍

@btea btea merged commit 2c9d707 into dev Apr 2, 2026
17 checks passed
@btea btea deleted the fix/23955 branch April 2, 2026 01:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

@rzzf Thanks for your contribution! ❤️

@element-bot element-bot mentioned this pull request Apr 10, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Component] [table] There is a style bug with el-table: the hover state remains after the mouse moves away.

3 participants