feat: Add drag to toggle prop with tests and documentation updates#85
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
dragToToggleprop wired throughSplitPanel.vuetousePointer, gating the collapse/expand branch in pointer logic. - Documentation updates describing the new prop and fixing a
collapsibleThreshold→collapseThresholdtypo. - New unit tests covering
dragToToggle: falsefor 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.
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.
This pull request introduces a new
dragToToggleprop to theSplitPanelcomponent, 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
dragToToggleboolean prop toSplitPanel, defaulting totrue, 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].dragToToggleprop, so collapsing/expanding on drag only occurs if enabled (packages/vue-split-panel/src/composables/use-pointer.ts) [1] [2].Documentation
dragToToggleprop, including its default value and usage details (docs/content/1.getting-started/2.usage.md) [1] [2].Testing
dragToToggleisfalse, 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.