Skip to content

Add parallax support to PHP render_block filter#21

Open
fellyph wants to merge 4 commits intomainfrom
claude/implement-todo-item-oSrlo
Open

Add parallax support to PHP render_block filter#21
fellyph wants to merge 4 commits intomainfrom
claude/implement-todo-item-oSrlo

Conversation

@fellyph
Copy link
Owner

@fellyph fellyph commented Jan 10, 2026

The JavaScript code already supported parallax attributes (parallaxEnabled,
parallaxStrength) for static block output, but the PHP render_block filter
was missing this support for dynamic blocks on the frontend.

This change ensures that when parallax is enabled on a block:

  • The data-parallax and data-parallax-strength attributes are added
  • The --parallax-strength CSS custom property is set inline
  • Frontend styles are properly enqueued

This was identified as a missing feature from the READING-PROGRESS-BAR.md
roadmap documentation.

Open WordPress Playground Preview

The JavaScript code already supported parallax attributes (parallaxEnabled,
parallaxStrength) for static block output, but the PHP render_block filter
was missing this support for dynamic blocks on the frontend.

This change ensures that when parallax is enabled on a block:
- The data-parallax and data-parallax-strength attributes are added
- The --parallax-strength CSS custom property is set inline
- Frontend styles are properly enqueued

This was identified as a missing feature from the READING-PROGRESS-BAR.md
roadmap documentation.
Ran npm run lint:js and npm run lint:css to apply consistent
code formatting across the codebase per project conventions.
@github-actions
Copy link

🤖 Hi @fellyph, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

This Pull Request introduces parallax functionality and significantly refactors the codebase for improved consistency in indentation and coding style. The changes are well-implemented and enhance the plugin's features while maintaining good code quality.

🔍 General Feedback

  • The refactoring to use tabs for indentation across multiple file types (PHP, JS, CSS, TS) is a great step towards maintaining a consistent coding style throughout the project.
  • The new parallax feature is integrated cleanly into both the backend logic and the frontend editor controls.
  • The use of new variables in my-scroll-block.php for conditional checks enhances readability and maintainability.
  • Good attention to detail in updating existing tests for the new formatting.

$attrs = $block['attrs'];
if ( isset( $attrs['animationType'] ) && 'none' !== $attrs['animationType'] ) {

$has_animation = isset( $attrs['animationType'] ) && 'none' !== $attrs['animationType'];

Choose a reason for hiding this comment

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

🟢 This condition is crucial for determining whether to apply scroll animation or parallax effects. A brief comment explaining its purpose would enhance code clarity.

opacity: 0;
transition: opacity 0.3s ease;
}

Choose a reason for hiding this comment

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

🟢 For consistency, consider using double quotes for string content.

counter-increment: percentage 100;
content: counter(percentage);
}
}

Choose a reason for hiding this comment

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

🟢 For consistency, consider using double quotes for string content.

*/

/* Base defaults */
@property --anim-displacement-horizontal {

Choose a reason for hiding this comment

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

🟢 For consistency, consider using double quotes for string syntax.

inherits: true;
initial-value: 10vw;
}

Choose a reason for hiding this comment

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

🟢 For consistency, consider using double quotes for string syntax.

src/style.css Outdated
animation-timeline: scroll(root block);
animation-range: 0% 100%;
}

Choose a reason for hiding this comment

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

🟢 For consistency, consider using double quotes for data attribute selectors.

claude and others added 2 commits January 10, 2026 22:22
- Add helper functions to properly dismiss WordPress welcome modal
- Handle multiple possible modal dismiss button patterns
- Add helper function for adding paragraph blocks with proper waiting
- Improve element waiting with explicit timeouts
- Wait for sidebar to be ready before interacting with animation controls
- Apply code formatting with Prettier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants