Skip to content

Add expand to the section block - #480

Merged
kbasutkar-hubspot merged 3 commits into
masterfrom
kbasutkar/section-block-expand
Oct 6, 2026
Merged

kbasutkar-hubspot merged 3 commits into
masterfrom
kbasutkar/section-block-expand

Conversation

@kbasutkar-hubspot

Copy link
Copy Markdown
Contributor

Why

Slack collapses long section text behind "Show more" unless the block sets expand: true. Section doesn't have this field yet, so callers can't turn the collapse off. In slack-integration, a Breeze workflow plan card puts its steps in a section, and Slack cuts the list off partway through. The web app always shows the whole plan.

What

Adds an optional expand field to SectionIF. It is left out of the JSON when not set, so existing sections serialize exactly as before.

Tests

New SectionBlockTest:

  • expand: true is serialized when set
  • expand is left out when not set
  • expand deserializes from JSON

The full slack-base suite passes locally.

🤖 Generated with Claude Code

Slack collapses long section text behind "Show more" unless the block
sets expand: true. slack-integration needs this so the Breeze workflow
plan card always shows every step, as the web app does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@yyakhnytsia yyakhnytsia 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.

reviewed, left small comment for improvement.


Optional<BlockElement> getAccessory();

Optional<Boolean> getExpand();

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.

Could you please leave the link to Slack API documentation about this element: https://docs.slack.dev/reference/block-kit/blocks/section-block?
Like it's done for the other elements, like TaskCardBlockIF, MarkdownBlockIF, this makes it easier to check the parameters and structure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the link to the section block docs on SectionIF in 834446b, following the same pattern as TaskCardBlockIF and MarkdownBlockIF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@yyakhnytsia yyakhnytsia 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.

LGTM.

}

@Test
public void itDeserializesExpand() throws IOException {

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.

doesn't cover expand(false). Optional.of(false) should serialize as "expand": false, not be dropped, but nothing asserts it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added itSerializesExpandFalseWhenSet in 2d8d54a. It builds a section with expand(false) and asserts that the JSON has an expand key set to the boolean false, so an explicit false isn't dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kbasutkar-hubspot
kbasutkar-hubspot merged commit 92d3670 into master Oct 6, 2026
2 checks passed
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