-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ActionSheetItem): fix navigation by arrows in selectable ActionSh…
…eetItem (#7216) h2. Описание При навигации с помощью стрелочек по `ActionSheetItems` с `selectable` флагом закрывается `ActionSheet` h2. Изменения - Поисследовал проблему с тригером события `click` при навигации по элементам. Нашел вариант как можно ее обойти facebook/react#7407. С помощью проверки можно отличить реальное событие клика. - Добавил обработку нажатия кнопки `Enter`, при котором происходит закрытие `ActionSheet` - Добавил тесты для нового функционала
- Loading branch information
1 parent
0e63369
commit 0d94b24
Showing
7 changed files
with
143 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* По дизайну `ActionSheet` должен закрывать при клике на `ActionSheetItem`. | ||
* В режиме `selectable` в реализации используются нативный input type=radio | ||
* И при навигации стрелочками по элементам происходит событие `click` из-за чего `ActionSheet` закрывается. | ||
* Поэтому нужно как-то отличить реальное событие клика | ||
* @see https://github.com/facebook/react/issues/7407 | ||
* @see https://github.com/VKCOM/VKUI/issues/6954 | ||
*/ | ||
export const isRealClickEvent = (event: React.MouseEvent) => { | ||
return event.type === 'click' && event.clientX !== 0 && event.clientY !== 0; | ||
}; |