Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection issue on start dragging #168

Open
Tal500 opened this issue Jun 16, 2022 · 0 comments
Open

Selection issue on start dragging #168

Tal500 opened this issue Jun 16, 2022 · 0 comments

Comments

@Tal500
Copy link

Tal500 commented Jun 16, 2022

There is a bug while trying to start dragging. The user can accidentally select one pane content, if he is fast enough.
In Firefox, if the user goes to the edge of the split and drag fast enough, he may be able to select (wasn't happen in Edge.) Here is a demo in Firefox:

splitpane-selection-issue.mov

The user is unable to select it after the "first frame" of the dragging, because of the following lines in the css conf:

render () {
return h(
'div',
{
ref: 'container',
class: [
'splitpanes',
`splitpanes--${this.horizontal ? 'horizontal' : 'vertical'}`,
{
'splitpanes--dragging': this.touch.dragging
}
]
},
this.$slots.default()
)
}
}

and the following css def:
&__pane {
width: 100%;
height: 100%;
overflow: hidden;
.splitpanes--vertical & {transition: width 0.2s ease-out;}
.splitpanes--horizontal & {transition: height 0.2s ease-out;}
.splitpanes--dragging & {transition: none;}
}

However, the user can do on the "first frame" (in Firefox at least) if he is fast enough. The reason is bacause
The reason it happen is because this.touch.dragging is set to true only in:

onMouseMove (event) {
if (this.touch.mouseDown) {
// Prevent scrolling while touch dragging (only works with an active event, eg. passive: false).
event.preventDefault()
this.touch.dragging = true
this.calculatePanesSize(this.getCurrentMouseDrag(event))
this.$emit('resize', this.panes.map(pane => ({ min: pane.min, max: pane.max, size: pane.size })))
}
},

but rather should be set to true starting from onMouseDown.
This way, the browser would immediately forbid the user to select the panes, and wouldn't wait for the next onMouseMove event.

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

No branches or pull requests

1 participant