-
Notifications
You must be signed in to change notification settings - Fork 185
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(useFloatingWithInteractions): improve restoreFocus, add restoreFocus to anchor element #7806
fix(useFloatingWithInteractions): improve restoreFocus, add restoreFocus to anchor element #7806
Conversation
…cus to anchor element
size-limit report 📦
|
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. |
e2e tests |
👀 Docs deployed
Commit c07f29c |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7806 +/- ##
==========================================
- Coverage 95.34% 95.30% -0.05%
==========================================
Files 378 378
Lines 11176 11197 +21
Branches 3726 3735 +9
==========================================
+ Hits 10656 10671 +15
- Misses 520 526 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# Conflicts: # packages/vkui/src/components/FocusTrap/FocusTrap.tsx
packages/vkui/src/lib/floating/useFloatingWithInteractions/useFloatingWithInteractions.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
ps: в описании осталась старая инфа про latest-element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💅
❌ PatchНе удалось автоматически применить исправление на ветке 7.0-stable.
Чтобы изменение попало в ветку 7.0-stable, выполните следующие действия:
git stash # опционально
git fetch origin 7.0-stable
git checkout -b patch/pr7806 origin/7.0-stable
git cherry-pick --no-commit 3589018217b211293a953e717379e544b7df44ea
git checkout HEAD **/__image_snapshots__/*.png
git diff --quiet HEAD || git commit --no-verify --no-edit
git push --set-upstream origin patch/pr7806
gh pr create --base 7.0-stable --title "patch: pr7806" --body "- patch #7806" |
❌ PatchНе удалось автоматически применить исправление на ветке v6.
Чтобы изменение попало в ветку v6, выполните следующие действия:
git stash # опционально
git fetch origin v6
git checkout -b patch/pr7806 origin/v6
git cherry-pick --no-commit 3589018217b211293a953e717379e544b7df44ea
git checkout HEAD **/__image_snapshots__/*.png
git diff --quiet HEAD || git commit --no-verify --no-edit
git push --set-upstream origin patch/pr7806
gh pr create --base v6 --title "patch: pr7806" --body "- patch #7806" |
Описание
Нужно добавить возможность настройки элемента, куда будет возвращаться фокус после закрытия поповера по ховеру.
Изменения
В
Popover
иTooltip
расширил тип свойстваrestoreFocus
. Теперь помимоboolean
он может принимать следующие значения:'anchor-element'
- означает, что фокус будет возвращен на якорный элементHTMLElement
- можно использовать ссылку на определенный html элементТакже изменения затронули компонент
FocusTrap
:restoreFocus
можно прокинуть, помимо функции, возвращающейboolean
, функцию, возвращающуюHTMLElement
(() => boolean | HTMLElement
).Теперь, чтобы поправить баг описанный в задаче необходимо для
Popover
сtrigger="hover"
прокинутьrestoreFocus="anchor-element"
Release notes
Улучшения
restoreFocus
доboolean | 'anchor-element' | HTMLElement
для указания на какой элемент будет возвращен фокус после закрытияPopover
. Полезно для кейса сPopover
сtrigger="hover"
, при установкеrestoreFocus="anchor-element"
фокус всегда будет возвращаться в якорный элемент