Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7a79026
Refactor withFocusOutside to a hook
talldan Nov 30, 2020
5a54bf2
Fix type for ref
talldan Nov 30, 2020
a12e8c0
Try to fix event target
talldan Nov 30, 2020
d240030
Refactor withFocusOutside to use useFocusOutside
talldan Nov 30, 2020
511d3fc
Fix detect-outside which should bind `this`
talldan Nov 30, 2020
0cf2155
Fix type issues
talldan Nov 30, 2020
1789e68
Remove unused ref
talldan Nov 30, 2020
79ebf26
Only cancel blur check on unmount
talldan Nov 30, 2020
ae10891
Remove need to bind callback when using withFocusOutside
talldan Dec 1, 2020
8a5f6b5
cancel blur check when onFocusOutside is no longer defined
talldan Dec 1, 2020
99260ad
Fix issue with HOC handleFocusOutside callback not being triggered du…
talldan Dec 2, 2020
cc4c941
Only return unstable ref when callback arg is not defined
talldan Dec 2, 2020
405e61f
Use an additional param for the unstable ref instead of a return value
talldan Dec 2, 2020
2ab9510
Move use-focus-outside to file alongside other hooks in folder
talldan Dec 3, 2020
440930b
Add tests for use-focus-outside
talldan Dec 3, 2020
e88d7ff
Improve types
talldan Dec 3, 2020
825422d
UseCallback for callbacks returned from hook
talldan Dec 3, 2020
4ed9409
Remove type from typedef
talldan Dec 4, 2020
85dec18
Remove refs from dependency list
talldan Dec 7, 2020
3aa2610
Update dependency list
talldan Dec 7, 2020
4290add
Update dependency list
talldan Dec 7, 2020
ddaf880
code formatting
talldan Dec 7, 2020
14c4786
Use a callback ref to remove the additional `__unstableNodeRef` param…
talldan Dec 8, 2020
3d3d5c3
Fix code review issues
talldan Dec 8, 2020
764e812
Use a ref for onFocusOutside
talldan Dec 9, 2020
33f7f92
Move useFocusOutside to @wordpress/compose and make experimental
talldan Dec 9, 2020
bef83bc
Port react native component
talldan Dec 9, 2020
f21e576
Remove missing export
talldan Dec 9, 2020
2282504
Try something
talldan Dec 9, 2020
96784d8
Revert "Try something"
talldan Dec 9, 2020
c848198
Make native version of hook
talldan Dec 10, 2020
cbd8a1f
Export native version of hook
talldan Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix code review issues
  • Loading branch information
talldan committed Dec 10, 2020
commit 3d3d5c3e2bc9452a9623b181f57dfcb8aff623ae
10 changes: 4 additions & 6 deletions packages/components/src/higher-order/with-focus-outside/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ export default createHigherOrderComponent(
( node ) =>
setHandleFocusOutside( () =>
node?.handleFocusOutside
? node.handleFocusOutside.bind(
node,
node.handleFocusOutside
)
? node.handleFocusOutside.bind( node )
: undefined
Copy link
Member

Choose a reason for hiding this comment

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

If we want to avoid re-rendering, then we should probably return the prev state to bail out update.

),
[ setHandleFocusOutside ]
[]
);

return (
Expand All @@ -33,5 +30,6 @@ export default createHigherOrderComponent(
/>
</div>
);
}
},
'withFocusOutside'
);