Skip to content

feat: Add drag to toggle prop with tests and documentation updates#85

Merged
rijkvanzanten merged 3 commits into
mainfrom
disable-drag-to-collapse
May 29, 2026
Merged

feat: Add drag to toggle prop with tests and documentation updates#85
rijkvanzanten merged 3 commits into
mainfrom
disable-drag-to-collapse

Conversation

@rijkvanzanten

Copy link
Copy Markdown
Member

This pull request introduces a new dragToToggle prop to the SplitPanel component, allowing developers to control whether dragging past the collapse threshold will collapse or expand the primary panel. By default, this behavior is enabled, but it can now be disabled for more granular control. The documentation and tests have been updated to reflect this new option.

Feature: Drag-to-toggle collapsibility

  • Added a new dragToToggle boolean prop to SplitPanel, defaulting to true, which determines if dragging beyond the collapse threshold will trigger collapse/expand actions (packages/vue-split-panel/src/types.ts, packages/vue-split-panel/src/SplitPanel.vue) [1] [2].
  • Updated the internal pointer logic to respect the dragToToggle prop, so collapsing/expanding on drag only occurs if enabled (packages/vue-split-panel/src/composables/use-pointer.ts) [1] [2].

Documentation

  • Documented the new dragToToggle prop, including its default value and usage details (docs/content/1.getting-started/2.usage.md) [1] [2].

Testing

  • Added and updated tests to verify behavior when dragToToggle is false, ensuring that drag gestures do not collapse/expand the panel but still update the size and snap to snap points as expected (packages/vue-split-panel/src/composables/use-pointer.test.ts) [1] [2] [3].

These changes provide more flexibility for users who want to disable drag-to-collapse behavior while retaining keyboard and programmatic toggling.

Copilot AI 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.

Pull request overview

Adds a dragToToggle prop (default true) to SplitPanel that lets consumers disable drag-based collapse/expand while preserving keyboard and programmatic toggling.

Changes:

  • New dragToToggle prop wired through SplitPanel.vue to usePointer, gating the collapse/expand branch in pointer logic.
  • Documentation updates describing the new prop and fixing a collapsibleThresholdcollapseThreshold typo.
  • New unit tests covering dragToToggle: false for collapse, expand, size updates, and snapping.

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
packages/vue-split-panel/src/types.ts Adds dragToToggle?: boolean to SplitPanelProps with JSDoc default.
packages/vue-split-panel/src/SplitPanel.vue Defaults dragToToggle to true and passes it to usePointer.
packages/vue-split-panel/src/composables/use-pointer.ts Adds option and gates the collapse-threshold branch on dragToToggle.
packages/vue-split-panel/src/composables/use-pointer.test.ts Adds tests for dragToToggle: false behavior.
docs/content/1.getting-started/2.usage.md Documents new prop; also corrects collapsibleThreshold typo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rijkvanzanten rijkvanzanten changed the title Add drag to toggle prop with tests and documentation updates feat: Add drag to toggle prop with tests and documentation updates May 29, 2026
@rijkvanzanten
rijkvanzanten merged commit d92e8ad into main May 29, 2026
3 of 4 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