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
Make getLastFocus and setLastFocus private #57612
Conversation
Size Change: +1.12 kB (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
const { getLastFocus } = useSelect( blockEditorStore ); | ||
const getLastFocus = useSelect( | ||
( select ) => unlock( select( blockEditorStore ) ).getLastFocus | ||
); |
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.
I think const { getLastFocus } = unlock( useSelect( blockEditorStore ) );
is supported
const { setNavigationMode, setLastFocus } = useDispatch( blockEditorStore ); | ||
const { setNavigationMode, setLastFocus } = unlock( | ||
useDispatch( blockEditorStore ) | ||
); | ||
const isNavigationMode = useSelect( | ||
( select ) => select( blockEditorStore ).isNavigationMode(), | ||
[] | ||
); | ||
|
||
const lastFocus = useSelect( |
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.
I think in this file as well, the lastFocus ref is only used in callbacks so there's a micro-optimization that is possible by using const { getLastFocus } = unlock( useSelect( blockEditorStore ) );
instead and only calling getLastFocus
within the callbacks.
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.
LGTM
What?
Removes getLastFocus/setLastFocus from the public API #55712 (comment).
Why?
How?
Moves the selector and action to be private.
Testing Instructions
Testing Instructions for Keyboard
There should be no change from trunk. This mostly impacts pressing the Escape toolbar
Screenshots or screencast