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

fix(ImageBaseOverlay): fix nested Tappable #7006

Merged
merged 8 commits into from
Jul 8, 2024

Conversation

BlackySoul
Copy link
Contributor

@BlackySoul BlackySoul commented Jun 10, 2024


  • Unit-тесты
  • Документация фичи (?)

Описание

by design вложенные Tappable ресетят hover/active-состояние верхнеуровневого Tappable, чтобы поддержать следующее поведение (актуально только для 2-х уровневой вложенности, это оке?):

2024-06-11.00.58.07.mov

В случае с ImageBaseOverlay такое поведение нежелательно.

Изменения

Добавила DisableClickableLockStateContext для отключения такого поведения (принимаю в пожертвование лучшее название).
Сначала думала сделать это через проп на Tappable, но, кажется, что DX такого решения будет сомнительный. Например, в случае с ImageBaseOverlay мы точно знаем, что дефолтное поведение не нужно, но будем заставлять пользователя в каждую кнопку прокидывать проп 🤔

Изменения v2

В текущей версии компонента некорректно передавать в overlay интерактивные элементы, потому что получается кнопка в кнопке.

В новой реализации убрала использование Tappable - кажется, это не breaking change, потому что мы никакие пропы, специфичные для Tappable не прокидывали - по сути он нам нужен только для hover-эффекта (остальное мы либо отключаем, либо не можем отключить, но оно мешает - например, меняется вид поинтера). В итоге получился интерактивный и неинтерактивный компоненты, принимаем решение, какой из них рисовать, на основе нового пропа disableInteractive - в таске предлагали завязываться на onClick, но такое мы не можем провернуть - потому что сейчас поведение по-умолчанию - если onClick не передан, то мы подставляем noop и hover-эффект работает из коробки (кому-то можем сломать это поведение).

@BlackySoul BlackySoul requested a review from a team as a code owner June 10, 2024 18:06
@github-actions github-actions bot added the patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча label Jun 10, 2024
Copy link
Contributor

github-actions bot commented Jun 10, 2024

size-limit report 📦

Path Size
JS 369.57 KB (+0.18% 🔺)
JS (gzip) 113.19 KB (+0.17% 🔺)
JS (brotli) 93.25 KB (+0.2% 🔺)
JS import Div (tree shaking) 1.42 KB (0%)
CSS 298.96 KB (+0.05% 🔺)
CSS (gzip) 38.06 KB (+0.06% 🔺)
CSS (brotli) 30.63 KB (-0.07% 🔽)

Copy link

codesandbox-ci bot commented Jun 10, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

github-actions bot commented Jun 10, 2024

e2e tests

Playwright Report

Copy link
Contributor

github-actions bot commented Jun 10, 2024

👀 Docs deployed

Commit 65c988e

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 93.02326% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.93%. Comparing base (d50512c) to head (65c988e).
Report is 15 commits behind head on master.

Files Patch % Lines
...src/components/ImageBase/ImageBaseOverlay/hooks.ts 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7006      +/-   ##
==========================================
+ Coverage   83.91%   83.93%   +0.02%     
==========================================
  Files         357      358       +1     
  Lines       10785    10814      +29     
  Branches     3557     3560       +3     
==========================================
+ Hits         9050     9077      +27     
- Misses       1735     1737       +2     
Flag Coverage Δ
unittests 83.93% <93.02%> (+0.02%) ⬆️

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.

mendrew
mendrew previously approved these changes Jun 11, 2024
Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

💅

Copy link
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

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

@inomdzhon inomdzhon marked this pull request as draft June 11, 2024 14:29
@vkcom-publisher vkcom-publisher added pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности and removed pr-needs-work Автоматизация: PR автоматически закроется через 14 дней при отсутствии активности labels Jun 19, 2024
@BlackySoul BlackySoul force-pushed the fix/7001/ImageBase.overlay_fix_nested_tappable branch from 737557d to 7ac884e Compare June 26, 2024 07:05
@BlackySoul BlackySoul marked this pull request as ready for review June 26, 2024 07:35
mendrew
mendrew previously approved these changes Jun 27, 2024
Copy link
Contributor

@mendrew mendrew left a comment

Choose a reason for hiding this comment

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

LGTM 👍

mendrew
mendrew previously approved these changes Jun 27, 2024
@inomdzhon inomdzhon removed the patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча label Jun 27, 2024
@BlackySoul BlackySoul force-pushed the fix/7001/ImageBase.overlay_fix_nested_tappable branch from 72d4bcf to 3e63cb6 Compare July 4, 2024 07:00
Copy link
Contributor

@inomdzhon inomdzhon left a comment

Choose a reason for hiding this comment

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

💅 🔥 🙏

@BlackySoul BlackySoul merged commit c354c50 into master Jul 8, 2024
26 checks passed
@BlackySoul BlackySoul deleted the fix/7001/ImageBase.overlay_fix_nested_tappable branch July 8, 2024 11:33
@BlackySoul BlackySoul added the patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча label Jul 8, 2024
BlackySoul added a commit that referenced this pull request Jul 8, 2024
* fix(ImageBaseOverlay): fix nested Tappable

* fix(ImageBaseOverlay): add non interactive wrapper

* chore: clean up

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>

* chore: fix prettier

* fix: review notes

* fix merge

* fix: remove tests

* fix: revert DisableClickableLockStateContext  adding

---------

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>
BlackySoul added a commit that referenced this pull request Jul 8, 2024
* fix(ImageBaseOverlay): fix nested Tappable

* fix(ImageBaseOverlay): add non interactive wrapper

* chore: clean up

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>

* chore: fix prettier

* fix: review notes

* fix merge

* fix: remove tests

* fix: revert DisableClickableLockStateContext  adding

---------

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>
BlackySoul added a commit that referenced this pull request Jul 8, 2024
)

* fix(ImageBaseOverlay): fix nested Tappable (#7006)

* fix(ImageBaseOverlay): fix nested Tappable

* fix(ImageBaseOverlay): add non interactive wrapper

* chore: clean up

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>

* chore: fix prettier

* fix: review notes

* fix merge

* fix: remove tests

* fix: revert DisableClickableLockStateContext  adding

---------

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>

* fix: run prettier

* CHORE: Update screenshots

* fix: delete e2e test

---------

Co-authored-by: Andrey Medvedev <andr.medv.spb@gmail.com>
Co-authored-by: GitHub Action <actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Автоматизация: PR продублируется в ветку последнего минорного релиза для выпуска патча
Projects
None yet
5 participants