Skip to content

Inform the user if the current theme explicitly supports view transitions with its own configuration, and add a UI control to make overriding that configuration via settings optional #2037

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

Merged
merged 9 commits into from
Jul 2, 2025

Conversation

felixarntz
Copy link
Member

@felixarntz felixarntz commented Jun 5, 2025

Summary

This solves the problem that currently the settings will always be applied, even if the current theme already supports view transitions explicitly. At the moment, this means the actual theme support arguments are never respected, as the plugin will always apply the settings to it.

Relevant technical choices

  • Store in a global variable whether the current theme supports view transitions with custom arguments.
  • If so, show a notice to the user in the settings UI to inform them about it.
  • Also show a checkbox (by default unchecked) that allows to opt in to overriding the theme support arguments with the settings, simply as an extra opt-in step and safeguard.
    • If not checked, the other settings will be effectively ignored if the current theme supports view transitions with custom arguments.
    • If the theme support does not use custom arguments or if it's simply polyfilled by the plugin, this checkbox is not shown because it's irrelevant. In that case, the settings will always be applied.

Testing

To test the different behavior when using a theme with explicit support, the active theme must add_theme_support( 'view-transitions', $args ), with a concrete list of arguments, in other words, not just add_theme_support( 'view-transitions' ).

For example, add this to your theme's functions.php:

add_action(
	'after_setup_theme',
	static function () {
		add_theme_support( 'view-transitions', array( 'default-animation' => 'slide-from-right' ) );
	}
);

With this added, your site should now always use the "slide from right" animation for view transitions, even if the WP Admin setting for the default transition animation is set to something else (e.g. the default "fade"). Only if you activate the new checkbox to override the theme's config, the other WP Admin settings for the frontend will take effect, overriding whatever the theme defines.

…ions with its own configuration, and add a UI control to make overriding that configuration via settings optional.
@felixarntz felixarntz added this to the view-transitions n.e.x.t milestone Jun 5, 2025
@felixarntz felixarntz added [Type] Bug An existing feature is broken [Plugin] View Transitions Issues for the View Transitions plugin labels Jun 5, 2025
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 4.91803% with 58 lines in your changes missing coverage. Please review.

Project coverage is 67.31%. Comparing base (8856a14) to head (469b8f0).
Report is 10 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/view-transitions/includes/settings.php 0.00% 58 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2037      +/-   ##
==========================================
- Coverage   67.74%   67.31%   -0.44%     
==========================================
  Files          93       93              
  Lines        7664     7718      +54     
==========================================
+ Hits         5192     5195       +3     
- Misses       2472     2523      +51     
Flag Coverage Δ
multisite 67.31% <4.91%> (-0.44%) ⬇️
single 36.64% <4.91%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@felixarntz felixarntz self-assigned this Jun 8, 2025
@felixarntz felixarntz marked this pull request as ready for review June 20, 2025 17:41
Copy link

github-actions bot commented Jun 20, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: felixarntz <flixos90@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@felixarntz felixarntz requested a review from westonruter June 20, 2025 17:41
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @felixarntz for the PR!

The admin transition currently doesn’t respect the override setting, which needs to be addressed. Other than that, I’ve left some feedback comments.

add_action(
	'after_setup_theme',
	static function () {
		add_theme_support( 'view-transitions', array( 'default-animation' => 'slide-from-right', 'enable_admin_transitions' => false ) );
	}
);

@felixarntz
Copy link
Member Author

@mukeshpanchal27

The admin transition currently doesn’t respect the override setting, which needs to be addressed. Other than that, I’ve left some feedback comments.

I don't think the admin transition needs to respect it, as the admin view transition behavior is independent of the theme's. So the checkbox to enable view transitions in WP Admin should always apply, regardless of what the theme does. Is that not the case currently?

@mukeshpanchal27
Copy link
Member

Is that not the case currently?

Yes, it is currently the case. However, for better clarity, if this feature is meant to be independent, we should consider mentioning that either in a notice or somewhere else in the UI so the end user is aware.

@felixarntz
Copy link
Member Author

Yes, it is currently the case. However, for better clarity, if this feature is meant to be independent, we should consider mentioning that either in a notice or somewhere else in the UI so the end user is aware.

Would it make sense to have that checkbox in an entirely separate section on the page? That would make it clear that it's not subject to the same notice. For example, in addition to the "View Transitions" section, we could have an "Admin View Transitions" section.

@mukeshpanchal27
Copy link
Member

Would it make sense to have that checkbox in an entirely separate section on the page? That would make it clear that it's not subject to the same notice. For example, in addition to the "View Transitions" section, we could have an "Admin View Transitions" section.

+1

@felixarntz
Copy link
Member Author

@mukeshpanchal27 I implemented a separate settings section for WP Admin in 469b8f0, and also addressed your other feedback. This is ready for another review.

@mukeshpanchal27 mukeshpanchal27 merged commit e5d1290 into trunk Jul 2, 2025
28 of 33 checks passed
@mukeshpanchal27 mukeshpanchal27 deleted the view-transitions/respect-theme-support branch July 2, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] View Transitions Issues for the View Transitions plugin [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants