Skip to content

fix(Button): fix hover state change with loading#9478

Merged
EldarMuhamethanov merged 2 commits intomasterfrom
e.muhamethanov/fix-button-hover-state-with-loading
Feb 12, 2026
Merged

fix(Button): fix hover state change with loading#9478
EldarMuhamethanov merged 2 commits intomasterfrom
e.muhamethanov/fix-button-hover-state-with-loading

Conversation

@EldarMuhamethanov
Copy link
Contributor

  • Release notes

Описание

Исправлен баг: после перехода кнопки из состояния загрузки (loading={true}) обратно в обычное состояние кнопка оставалась отображаться в состоянии hover, если курсор не покидал её во время загрузки.

Причина: в Clickable при hasHover={false} (когда у Button включён loading) обработчики onPointerEnter/onPointerLeave подменяются на noop, но внутреннее состояние hoveredStateLocal в хуке useHover не сбрасывалось. Курсор остаётся над кнопкой, pointerleave не срабатывает — при возврате hasHover={true} значение hoveredStateLocal по-прежнему true, и hover-стиль показывается некорректно.

Решение: в useHover (Clickable/useState.tsx) добавлен useEffect: при переходе hasHover в false сбрасываются hoveredStateLocal, prevIsHoveredRef и вызывается setParentStateLock(false) для согласованного состояния родителя.

Изменения

  • Clickable/useState.tsx: в useHover добавлен эффект, сбрасывающий локальное hover-состояние при hasHover === false, чтобы после повторного включения hover (например, по окончании loading) стиль применялся только при реальном наведении курсора.

Release notes

Исправления

  • Button: после завершения загрузки (loading: true → false) кнопка больше не остаётся в визуальном состоянии hover

@EldarMuhamethanov EldarMuhamethanov self-assigned this Feb 11, 2026
@EldarMuhamethanov EldarMuhamethanov requested a review from a team as a code owner February 11, 2026 13:46
@github-actions github-actions bot added the ci:cherry-pick:patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча label Feb 11, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

size-limit report 📦

Path Size
JS 411.66 KB (+0.02% 🔺)
JS (gzip) 126.16 KB (+0.02% 🔺)
JS (brotli) 104.13 KB (-0.17% 🔽)
JS import Div (tree shaking) 811 B (0%)
CSS 373.51 KB (0%)
CSS (gzip) 46.29 KB (0%)
CSS (brotli) 36.6 KB (0%)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

e2e tests

Playwright Report

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

📊 Найдены изменения в собранных файлах: Отчет

Commit a877176

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

👀 Docs deployed

📦 Package ✅

yarn add @vkontakte/vkui@https://development.s3.prodcloud.vk.team/pull/9478/a87717669d232825cca471582dce527bb2eb925f/pkg/@vkontakte/vkui/_pkg.tgz

Commit a877176

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.78%. Comparing base (869f68c) to head (a877176).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9478   +/-   ##
=======================================
  Coverage   94.78%   94.78%           
=======================================
  Files         441      441           
  Lines       11928    11933    +5     
  Branches     4394     4395    +1     
=======================================
+ Hits        11306    11311    +5     
  Misses        622      622           
Flag Coverage Δ
unittests 94.78% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@inomdzhon inomdzhon removed the ci:cherry-pick:patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча label Feb 11, 2026
@inomdzhon inomdzhon moved this to 👀 In Review in VKUI Feb 11, 2026
@inomdzhon inomdzhon added this to the v8.0.0 milestone Feb 11, 2026
SevereCloud
SevereCloud previously approved these changes Feb 12, 2026
@EldarMuhamethanov EldarMuhamethanov merged commit b97a94b into master Feb 12, 2026
29 checks passed
@EldarMuhamethanov EldarMuhamethanov deleted the e.muhamethanov/fix-button-hover-state-with-loading branch February 12, 2026 09:54
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in VKUI Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants