feat(comments): add options to collapse comments section#2717
Open
faisalahammad wants to merge 1 commit into
Open
feat(comments): add options to collapse comments section#2717faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
Replace the boolean "Collapse Comments" checkbox with a select control offering three options: don't collapse, collapse when more than one comment, and always collapse. This allows publishers to always collapse the comments section regardless of comment count. Backward compatible: existing boolean true values map to "collapse when more than one comment" behavior. Fixes Automattic#1430
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the boolean "Collapse Comments" checkbox with a select control offering three options: don't collapse, collapse when more than one comment, and always collapse. This allows publishers to always collapse the comments section regardless of comment count.
Fixes #1430
Changes
newspack-theme/inc/customizer.phpBefore:
After:
Why: Provides granular control over when comments collapse. Added
newspack_sanitize_select()for proper select validation.newspack-theme/comments.phpBefore:
After:
Why: Supports the three collapse modes. Boolean
truefrom existing installations maps to "collapse when more than one comment" for backward compatibility.Also added collapse wrapper around the comment form in the
elsebranch (when no comments exist) so "Always collapse" works with 0 comments.Testing
Test 1: Don't collapse (default)
Test 2: Collapse when more than one comment
Test 3: Always collapse
Test 4: Backward compatibility
Existing installations with checkbox enabled continue to work as "collapse when more than one comment".
Build
newspack-theme-fix-1430.zip available for manual testing. Install via
WP Admin → Appearance → Themes → Upload Theme.Screenshot