-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Global styles: incorrect usage of Navigator.BackButton
#65794
Comments
Thanks for the ping. I think it was because:
I'll test |
This one is for the global styles: #65810 I looked briefly into the font sizes panel, but it appears there's an existing bug that's preventing testing - the |
Fix incoming |
I think the font sizes component needs this. Otherwise, it'll skip the intermediary font sizes list: 2024-10-02.11.01.17.mp4So it might need a button refactor as you suggest. I'll just add the fix for the bug I saw for now. |
There are already two PRs with potential fixes:
I admittedly forgot to give y'all context about this bug, my bad There is also another PR that is fixing a separate issue #65791 Probably better to wait for the dust to settle on these urgent bug fixes, and then look at the code again |
Could we instead tweak the intermediate screen's path, so that it follows a "hierarchic" URL scheme? That should cause the default behavior of |
While working on #65790, I noticed that the
ScreenHeader
has aonBack
prop that gets called whenNavigator.BackButton
gets clicked:gutenberg/packages/edit-site/src/components/global-styles/header.js
Lines 21 to 26 in 8e4aac8
Navigator.BackButton
already performs a backward navigation (to the "parent" screen) — but I noticed usages where consumers ofScreenHeader
use theonBack
callback to trigger another navigation. This can cause unintended consequences, since it may triggerNavigator
to make two consecutive navigations.I could spot two usages:
Font sizes screen
gutenberg/packages/edit-site/src/components/global-styles/font-sizes/font-size.js
Line 154 in 8e4aac8
Calling
goTo
seems totally unnecessary here — if we just letNavigator.BackButton
do its job, I believe it would take us to the same screen. Also, usinggoTo
without theisBack
option causes the transition to move in the wrong direction.Revisions screen
gutenberg/packages/edit-site/src/components/global-styles/screen-revisions/index.js
Line 143 in 8e4aac8
Here I may need @ramonjd and @andrewserong 's help to understand why we need to navigate to
/
when clicking back.Could we change the code so that
Navigator.BackButton
's original behaviour is preserved?Alternatively, we'll need to see if we can
preventDefault
, or consider rendering aButton
(instead ofNavigator.BackButton
) inScreenHeader
, and make theonBack
callback an alternative to the "default" going back behaviour, instead of an addition.The text was updated successfully, but these errors were encountered: