Implement customizable transition animation duration setting#2321
Implement customizable transition animation duration setting#2321sarthak-19 wants to merge 16 commits intoWordPress:trunkfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #2321 +/- ##
==========================================
+ Coverage 69.33% 69.43% +0.09%
==========================================
Files 90 90
Lines 7749 7806 +57
==========================================
+ Hits 5373 5420 +47
- Misses 2376 2386 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Comment from @sarthak-19 in Slack:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @sarthak.jaiswal@rtCamp.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This comment was marked as resolved.
This comment was marked as resolved.
|
Another polishing idea: there could be validation added to the input fields for the CSS selectors. Maybe this would be as simple as a |
|
@westonruter I'm not able to figure out why unit test is failing for PHP 8.3+. Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 8.5.42 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.30
Time: 798 ms, Memory: 42.50 MB
OK (18 tests, 39 assertions)
✔ Ran `composer test:view-transitions` in 'tests-cli'. (in 2s 284ms)Any ideas ? |
|
@sarthak-19 Ah, it's because view transitions were added to the admin already in However, given that this has landed in the admin, I'm not sure we should actually add a setting for that part since it has already shipped, essentially. |
I was not sure how should I translate this in js for plugin. cc : @westonruter |
westonruter
left a comment
There was a problem hiding this comment.
This PR implements the transition animation duration setting that was previously added to the UI but wasn't functional.
Not functional in what way? I tried changing the duration in trunk to 4000 ms and I started seeing slow animations as expected.
| ?> | ||
| <style> | ||
| @view-transition { navigation: auto; } | ||
| ::view-transition-group(*) { --plvt-view-transition-animation-duration: <?php echo absint( $options['default_transition_animation_duration'] ); ?>ms; } |
There was a problem hiding this comment.
This can be reverted now that View Transitions are merged into core. We can iterate on any such setting in Trac.
|
|
||
| $options = plvt_get_stored_setting_value(); | ||
| if ( ! isset( $options['enable_admin_transitions'] ) || true !== $options['enable_admin_transitions'] ) { | ||
| if ( ! isset( $options['enable_admin_transitions'] ) || ! (bool) $options['enable_admin_transitions'] ) { |
There was a problem hiding this comment.
Why this change? It can be reverted anyway since this function is now obsolete for 7.0.
| * @param {string} selector The CSS selector to validate. | ||
| * @return {boolean} Whether the selector is valid. | ||
| */ | ||
| function validateSelector( selector ) { |
There was a problem hiding this comment.
Something is wrong here because it is flagging valid selectors as invalid:
Apparently it doesn't work for selector list 😦
CSS.supports( 'selector(foo)' )
=> true
CSS.supports( 'selector(foo,bar)' )
=> false
I guess we could switch to using a textarea where we indicate there should be one selector provided per line. But that's not very user-friendly or intuitive for someone used to writing CSS.
Maybe this validation feature isn't worthwhile, especially since this UI wouldn't be part of core eventually.
Part of a polishing issue : #2317
Summary
This PR implements the transition animation duration setting that was previously added to the UI but wasn't functional. The duration setting now properly affects view transitions on both the frontend and WordPress admin area.