Skip to content

Add social sharing, FAQ pattern with accordion, and icon-block audit (LS-1207)#12

Merged
brandonmarshal merged 2 commits into
developfrom
feature/LS-1207-content-blocks-implementation
Jul 21, 2026
Merged

Add social sharing, FAQ pattern with accordion, and icon-block audit (LS-1207)#12
brandonmarshal merged 2 commits into
developfrom
feature/LS-1207-content-blocks-implementation

Conversation

@brandonmarshal

@brandonmarshal brandonmarshal commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added the Social Sharing block (LinkedIn/Facebook/X/WhatsApp) to patterns/template-single.php, rendered after post content on the single-post template.
  • Added a new reusable FAQ pattern (patterns/section-faq.php) using Yoast SEO's native yoast/faq-block, with 3 placeholder Q&A pairs for editors to duplicate/edit.
  • Styled the FAQ block as a full accessible accordion — Yoast ships this block completely unstyled by design (confirmed via Yoast's own developer docs), so this adds a card look, animated +/- marker, and keyboard/ARIA-driven expand/collapse, all built from this theme's existing design tokens and motion system (src/scss/animations/_faq-motion.scss, assets/js/faq-accordion.js, conditionally enqueued in inc/animations.php only on pages containing the FAQ block).
  • Audited every pattern file for Icon Block (outermost/icon-block) usage per the plugin verification task. Found 2 empty placeholders (section-card-feature.php, section-card-solutions.php — intentional, duplicate-per-use patterns) and 9 icon instances across 4 CTA patterns that bypass the plugin entirely with hand-embedded inline SVG instead. No code changes made for this — findings documented on the issue and spun off into LS-1530 since it needs a design decision before any fix.

Full findings and discussion logged on LS-1207.

Closes LS-1207

Test plan

Static checks:

  • php -l clean on all changed/new PHP files
  • node theme-utils.mjs escape-patterns — no escaping/translation issues
  • node theme-utils.mjs validate-theme — no new failures introduced
  • npm run build:css compiles cleanly, new FAQ accordion CSS present in compiled output

Verified live on a local WordPress instance, not just statically:

  • Social Sharing block renders correctly on a real post (Share label + 4 working share icons)
  • FAQ pattern inserts cleanly via the block inserter and renders the accordion — confirmed click/keyboard toggle and visual styling
  • Icon Block plugin confirmed active on dev/live/local; empty placeholders confirmed by opening the 2 flagged patterns directly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a Frequently Asked Questions section with three predefined questions and answers.
    • Added an interactive, keyboard-accessible FAQ accordion with animated expand and collapse behavior.
    • Added reduced-motion support for accessibility.
    • Added social-sharing links for LinkedIn, Facebook, X, and WhatsApp to single blog posts.

…(LS-1207)

Add the Social Sharing Block after post content on the single-post
template, and introduce a reusable FAQ section pattern using Yoast
SEO's native yoast/faq-block. Style the FAQ block as an accessible
accordion (card look, animated marker, keyboard/ARIA support) since
Yoast ships it unstyled by design.
@brandonmarshal brandonmarshal added area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration lang:css Stylesheets lang:js JavaScript/TypeScript lang:php PHP code priority:normal Default priority for most issues. labels Jul 20, 2026
@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

LS-1207

@brandonmarshal brandonmarshal self-assigned this Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@brandonmarshal, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 1018e9e6-3849-4e45-ab6f-eb989cbe4a75

📥 Commits

Reviewing files that changed from the base of the PR and between bc16639 and 8fd523e.

📒 Files selected for processing (6)
  • assets/css/animations.css
  • assets/js/faq-accordion.js
  • inc/animations.php
  • patterns/section-faq.php
  • patterns/template-single.php
  • src/scss/animations/_faq-motion.scss

Note

.coderabbit.yml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "version"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a Yoast FAQ accordion with responsive styling, keyboard and ARIA interactions, reduced-motion support, and conditional script loading. Also adds a reusable FAQ pattern and a social-sharing section to the single blog template.

Changes

FAQ accordion

Layer / File(s) Summary
FAQ markup and presentation
patterns/section-faq.php, src/scss/animations/_faq-motion.scss, assets/css/animations.css
Adds a reusable FAQ pattern and styles for layout, open states, chevron rotation, answer transitions, and reduced motion.
FAQ interaction behavior
assets/js/faq-accordion.js
Adds ARIA attributes, answer IDs, click handling, keyboard activation, and accordion state synchronization.
Conditional script loading
inc/animations.php
Enqueues the deferred accordion script only when the Yoast FAQ block is present.

Single-template social sharing

Layer / File(s) Summary
Social-sharing section
patterns/template-single.php
Adds a styled Share section with LinkedIn, Facebook, X, and WhatsApp links after post content.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WordPress
  participant FAQPattern
  participant FAQScript
  participant FAQUI
  WordPress->>FAQPattern: Render Yoast FAQ block
  WordPress->>FAQScript: Enqueue deferred script when block exists
  FAQScript->>FAQUI: Initialize FAQ questions and answers
  FAQUI->>FAQUI: Toggle open state on click or keyboard activation
Loading

Suggested labels: area:seo, comp:block-templates, status:needs-review

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main additions: social sharing, the FAQ accordion pattern, and the icon-block audit.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/LS-1207-content-blocks-implementation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new accordion feature for Yoast FAQ blocks, including SCSS styles, a JavaScript toggle script, a reusable FAQ pattern, and social sharing links in the single post template. The review feedback focuses on improving robustness and accessibility: implementing progressive enhancement by scoping accordion styles under a JS-applied ".is-accordion" class, replacing the unreliable "has_block" check with a "render_block" filter to ensure the script enqueues correctly in modern block themes, and making the JavaScript initialization idempotent while dynamically setting the initial "aria-expanded" state.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread assets/js/faq-accordion.js
Comment thread src/scss/animations/_faq-motion.scss
Comment thread inc/animations.php Outdated
Comment thread assets/js/faq-accordion.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
patterns/template-single.php (1)

2-9: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Fix the PHPCS-blocking file header.

Add an @package tag to the pattern file comment; PHPCS currently fails with “Missing @package tag in file comment.”

Proposed fix
 /**
  * Title: Template: Single
  * Slug: ls-theme/template-single
+ * `@package` ls-theme
  * Categories: template

As per path instructions, patterns/*.php files require correct Pattern registration header comments.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@patterns/template-single.php` around lines 2 - 9, Add the required `@package`
tag to the file-level docblock in the template-single pattern header, preserving
the existing pattern registration metadata and description so PHPCS recognizes
the file comment as valid.

Sources: Path instructions, Pipeline failures

🧹 Nitpick comments (1)
assets/js/faq-accordion.js (1)

22-22: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Initialize aria-expanded based on the section's actual state.

Currently, aria-expanded is hardcoded to 'false' on initialization. If a section is ever rendered with the is-open class by default (e.g., via backend logic or a modified block pattern), the ARIA state will be out of sync. Deriving the initial state from the class list ensures robustness.

♻️ Proposed refactor
-		question.setAttribute( 'aria-expanded', 'false' );
+		const isOpen = section.classList.contains( 'is-open' );
+		question.setAttribute( 'aria-expanded', isOpen ? 'true' : 'false' );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@assets/js/faq-accordion.js` at line 22, Update the FAQ accordion
initialization near question.setAttribute so aria-expanded is derived from
whether the associated section currently has the is-open class, setting it to
true for open sections and false otherwise instead of hardcoding false.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@patterns/section-faq.php`:
- Around line 1-13: Add the required `@package` ls-theme tag to the file-level
docblock in the section-faq pattern registration header, preserving the existing
metadata and formatting.

---

Outside diff comments:
In `@patterns/template-single.php`:
- Around line 2-9: Add the required `@package` tag to the file-level docblock in
the template-single pattern header, preserving the existing pattern registration
metadata and description so PHPCS recognizes the file comment as valid.

---

Nitpick comments:
In `@assets/js/faq-accordion.js`:
- Line 22: Update the FAQ accordion initialization near question.setAttribute so
aria-expanded is derived from whether the associated section currently has the
is-open class, setting it to true for open sections and false otherwise instead
of hardcoding false.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 62d5a4c3-0b3a-4de4-a909-37c874d236aa

📥 Commits

Reviewing files that changed from the base of the PR and between 31a4e9a and bc16639.

📒 Files selected for processing (7)
  • assets/css/animations.css
  • assets/js/faq-accordion.js
  • inc/animations.php
  • patterns/section-faq.php
  • patterns/template-single.php
  • src/scss/animations.scss
  • src/scss/animations/_faq-motion.scss

Comment thread patterns/section-faq.php
Add missing @Package tags to section-faq.php and template-single.php
to fix the PHPCS pipeline failure. Make the FAQ accordion progressively
enhanced by gating its collapse behavior behind a JS-applied
is-accordion class, so content stays fully visible if JavaScript
fails to load. Add an idempotency guard against double-initialization
and derive aria-expanded from actual state instead of hardcoding it.
Replace the has_block() check for enqueuing the accordion script with
a render_block filter, since has_block() only inspects the current
post's content and misses the block when rendered via template parts
or query loops.

@ZaredRogers ZaredRogers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice on @brandonmarshal

@brandonmarshal
brandonmarshal merged commit e8253e1 into develop Jul 21, 2026
5 of 7 checks passed
@brandonmarshal
brandonmarshal deleted the feature/LS-1207-content-blocks-implementation branch July 22, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:theme Theme & styles (templates, template parts, FSE) comp:block-patterns Patterns library/registration lang:css Stylesheets lang:js JavaScript/TypeScript lang:php PHP code priority:normal Default priority for most issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants