Skip to content

Welcome Page: Fix missing CSS when used as fallback #1820

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 8 commits into from
Jun 17, 2025

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Jun 16, 2025

While testing #1802 and #1806 I experienced a bug, where the CSS was not shown for the Welcome page when used as fallback.

When the plugin is configured to use only Actors (no blog user), the plugin loads the Welcome page as fallback if you try to load /wp-admin/options-general.php?page=activitypub&tab=blog-profile (same with other potentially deactivated settings pages). In this case the tab query param is blog-profile but it loads the welcome screen and because we have this check in place:

if ( 'welcome' === ( isset( $_GET['tab'] ) ? \sanitize_key( $_GET['tab'] ) : 'welcome' ) )

the welcome screen will be loaded without CSS.

Screenshot 2025-06-16 at 10 18 26

Proposed changes:

  • Check for loaded template file instead of tab, to show the CSS

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Checkout trunk
  • Change User-Mode to "Actors only"
  • Load /wp-admin/options-general.php?page=activitypub&tab=blog-profile
  • You will see the page with the missing CSS
  • Checkout this PR and re-do all the steps above

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

The Welcome screen now loads with proper styling when shown as a fallback.

@pfefferle pfefferle requested a review from obenland June 16, 2025 08:29
@pfefferle pfefferle self-assigned this Jun 16, 2025
@pfefferle pfefferle requested a review from Copilot June 16, 2025 09:14
Copilot

This comment was marked as outdated.

@obenland
Copy link
Member

Oh, nice catch! I saw that once in my testing and couldn't figure out what happened.

How would you feel about enqueueing it from the template itself, like we do with embeds? Could help avoid a bit of logic

@pfefferle
Copy link
Member Author

no real preference, so happy to move it to the template.

@pfefferle pfefferle requested a review from Copilot June 16, 2025 13:41
Copilot

This comment was marked as outdated.

@pfefferle pfefferle requested a review from Copilot June 17, 2025 06:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the issue of missing CSS on the Welcome page when it is used as a fallback by changing the CSS enqueue behavior. Key changes include:

  • Enqueueing the Welcome page CSS directly in the template.
  • Removing the redundant CSS enqueue action in the admin welcome fields.
  • Adding tests for polyfill functions and updating the changelog.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/includes/class-test-compat.php Added tests for new polyfill functions
templates/welcome.php Enqueued CSS directly in the template to fix the fallback styling issue
includes/wp-admin/class-welcome-fields.php Removed redundant enqueue_styles hook for the Welcome page
includes/compat.php Added polyfill for str_ends_with function
.github/changelog/1820-from-description Created changelog entry for the bug fix

@pfefferle
Copy link
Member Author

@obenland done

Copy link
Member

@obenland obenland left a comment

Choose a reason for hiding this comment

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

Do you want to keep the str_ends_with() stuff? It doesn't seem to be needed any longer

@pfefferle
Copy link
Member Author

I would love to keep it and simplify other parts of the code to use that instead!

@pfefferle pfefferle merged commit 19b0012 into trunk Jun 17, 2025
11 checks passed
@pfefferle pfefferle deleted the fix/welcom-css-issue branch June 17, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants