This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
chore: remove isFromKeyboard prop from components #1850
Merged
Merged
Conversation
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
Codecov Report
@@ Coverage Diff @@
## master #1850 +/- ##
==========================================
+ Coverage 69.64% 69.88% +0.24%
==========================================
Files 874 875 +1
Lines 7612 7534 -78
Branches 2216 2181 -35
==========================================
- Hits 5301 5265 -36
+ Misses 2303 2261 -42
Partials 8 8
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1850 +/- ##
==========================================
+ Coverage 69.66% 69.84% +0.17%
==========================================
Files 887 888 +1
Lines 7813 7762 -51
Branches 2262 2242 -20
==========================================
- Hits 5443 5421 -22
+ Misses 2360 2331 -29
Partials 10 10
Continue to review full report at Codecov.
|
👍 |
layershifter
changed the title
chore: remove isFromKeyboard
chore: remove isFromKeyboard prop components
Aug 29, 2019
layershifter
force-pushed
the
feat/remove-is-from-keyboard
branch
from
August 29, 2019 12:35
654377b
to
9a7ec37
Compare
layershifter
requested review from
dvdzkwsk,
kuzhelov and
levithomason
as code owners
August 29, 2019 13:42
layershifter
requested review from
miroslavstastny and
mnajdova
as code owners
August 29, 2019 13:42
layershifter
changed the title
chore: remove isFromKeyboard prop components
chore: remove isFromKeyboard prop from components
Aug 29, 2019
sophieH29
approved these changes
Aug 30, 2019
…/github.com/stardust-ui/react into feat/remove-is-from-keyboard # Conflicts: # CHANGELOG.md # packages/react/src/components/Attachment/Attachment.tsx # packages/react/src/components/Button/Button.tsx # packages/react/src/components/Embed/Embed.tsx # packages/react/src/components/List/ListItem.tsx # packages/react/src/components/Reaction/Reaction.tsx # packages/react/src/components/Toolbar/ToolbarCustomItem.tsx
…/github.com/stardust-ui/react into feat/remove-is-from-keyboard
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES
Alert
,Attachment
,Button
,ChatMessage
,Checkbox
,Embed
,Grid
,ListItem
,RadioGroupItem
,Reaction
,Slider
,ToolbarCustomItem
,ToolbarItem
,ToolbarMenuItem
do not haveisFromKeyboard
in their style functions anymore. Use:focus-visible
selector instead.AttachmentState
,ButtonState
,GridState
,ListItemState
,ReactionState
,ToolbarCustomItemState
,ToolbarItemState
,ToolbarMenuItemState
interfaces are no longer exported.Before
After
💣 Issue
To understand that event comes from a keyboard currently we have
isFromKeyboard
understate component's state. This solution creates at least two issues:onFocus
handlers that perform state changes and useless component render💡 Idea
The original proposal (#749) was to use polyfill for
:focus-visible
, but we meet at least two issues:To solve this I propose to use
:focus-visible
in our styles that will simplify the migration later and create a custom Fela enhancer.Why not plugin?
Fela plugins allow to modify styles, but to make this working I should change
selector
generation.🏎 What it does?
This enhancer performs a transform of generated selectors to replace
:focus-visible
withhtml[data-whatinput="keyboard"] + :focus
.buttonStyles.ts
Generated styles
The original prototype is there: https://codesandbox.io/s/young-dust-fy3b0
Untouched components
Menu
&Dropdown
components still will haveisFromKeyboard
under theirs states because they style container elements and this should be solved by:focus-within
instead or other tricks separately.