-
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
Cover: Padding: Fix reset + Visualize on hover #23041
Conversation
|
||
const initialValuesRef = useRef( values ); |
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.
No longer needed. It was previously used to hold onto the initial value for the session.
We need the reset action to completely nullify the box values.
label, | ||
value, | ||
...props | ||
} ) { | ||
const bindHoverGesture = useHover( ( { event, ...state } ) => { |
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.
Thank you react-use-gesture
🙏 !
Size Change: +716 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
Will this be added to 8.3.1? |
This is cool, Q! My local dev env is a bit challenged at the moment so I can't reliably test this. But based on the images, this seems to just need a code review! 👍 👍
Given this is still strictly opt-in and probably not yet on anyone's radar, it does not seem to warrant a point release. |
This will be backported for 8.3 release as part of #23026 as the other bugfixes we prepared during RC testing (the hook namespace change is a must-have to avoid block deprecations in future releases). Certainly, the visualizers improvement is not a bugfix but a lovely feature! 🌟 As a general rule, I think it'd be good to only land bugfixes after RC. However, in this specific case, given that the PR does all the things at once and that it's a new feature yet to be released, I'm ok going ahead with this. Worst-case scenario, we have to do a 8.3.1. |
- Edit Site: fix template lookup. #22954 - Fix for FSE template parts: #23050 - Fix link color style rule. #23025 - Fix for link color: it needs to be opt-in. #23049 - Revert "Image Block: add caption field to placeholder" #23027 - Cover padding: reset button + hook namespace + improve visualizer #23041 - Fix failing 'Build artifacts' CI job (by updating `package-lock.json`): #23052
This update fixes the reset handling for the new experimental Padding controls for the Cover block.
♻️ Reset Handling
Clicking reset now removes padding values completely.
It sets the values to
null
, which removes inline styling rendering into the Cover. This is an important detail, as we should still allow for users to set values of0px
, which is different than no value (null
).✨ Improved Visualizers
The Padding visualizers have been enhanced to show when the user hovers any one of the Padding controls. The visualizers also maintain the ability to flash during changes. Previously, the visualizers only revealed themselves on change.
📖 Update padding style (hook) namespace
This update changes the style hook of padding to be namespaced as:
Previously, it existed as
In order for the visualizers to be programmatically triggered (by hover interactions), the show/hide values have also been added to the style Object as:
This works. However, I feel like there could be a better way to connect these 2 Components (while avoiding adding state to the global
wp.data
). The solution I'm imagining would look similar to ZustandHow has this been tested?
To test...
npm run dev
add_theme_support( 'experimental-custom-spacing' )
(a place could be thenormalize-theme.php
file, undernormalize_theme_init
)Checklist:
Resolves: #23030