-
Notifications
You must be signed in to change notification settings - Fork 289
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
Fixed column resize on Android. #280
Conversation
1. In FixedDataTableCell: - in columnResizerComponent touch handlers, also preventDefault. - in _onColumnResizerMouseDown, also preventDefault.
1. In DOMMouseMoveTracker.js, eliminate handling the mouseout event. [The mouseout event is fired when a pointing device (usually a mouse) is moved off the element that has the listener attached or off one of its children.](https://developer.mozilla.org/en-US/docs/Web/Events/mouseout) Since the element that has the listener attached is document.body, this invariably does the wrong thing.
columnResizerComponent = ( | ||
<div | ||
className={cx('fixedDataTableCellLayout/columnResizerContainer')} | ||
style={columnResizerStyle} | ||
onMouseDown={this._onColumnResizerMouseDown} | ||
onTouchStart={this.props.touchEnabled ? this._onColumnResizerMouseDown : null} | ||
onTouchEnd={this.props.touchEnabled ? e => e.stopPropagation() : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SirGandal can you give this a quick look that it doesn't break your use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wcjordan sorry for the late reply. That should be fine.
@davidhaimson out of curiosity, what's the reason for preventDefault in onTouchEnd and onTouchMove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First thing I tried was adding event.preventDefault()
in the _onColumnResizerMouseDown
method. That made a big difference on the Android devices where I was testing this. Without it, trying to resize the columns scrolled the table body left/right. I made the corresponding change here for consistency.
Because of my injury, I am working from home, and I don't have the physical devices to test on. I tried removing all the preventDefault
calls, and it still works, on all the platforms, except I had to test Android and iOS in emulators. Now I don't know what to think.
I was able to test the version with all preventDefault
calls in the modified demo app on a physical iPhone and Android phone, and they worked fine. My intuition is that these calls are at the very least harmless, and the one in _onColumnResizerMouseDown
is necessary. But I can't prove it until I get back to work on site. Not sure when that will be - a couple of weeks, probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you want to do here? Should we wait til you're back on site and can test fully before finalizing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do that, but as I say, it'll be a couple of weeks. I already tested it fully (with the harmless, but possibly superfluous preventDefault
calls). My recommendation would be to merge it in its present form. When I am back on-site, we can do a PR trimming it down to the minimum necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll merge and look to release over the weekend. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're a prince! Thanks.
@@ -71,11 +70,6 @@ class DOMMouseMoveTracker { | |||
'mouseleave', | |||
this._onMouseEnd | |||
); | |||
this._eventOutToken = EventListener.listen( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for removing this rather than just fixing it?
It was added to fix #104, could you test out those cases on a few browsers? I tried in Chrome & Firefox and it seems the mouseleave event is enough for the fix to hold. @sisyphean2 do you remember why you added both mouseleave & mouseout handlers? Are there cases we should test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that because the mouseout hander was misspelled, (this.onMouseEnd instead of this._onMouseEnd) it never did anything. Fixing the spelling makes it fail miserably. No mouseout handler is needed.
Not really any changes needed, just some research and see if anyone has a good memory of the related risks...
@wcjordan: I had a bike accident, fractured a couple of bones, and I'm not
going to be working again until next week. So I'm not going to be able to
be as responsive as I'd like to be. Sorry!
Regarding the change to FixedDataTableCell.js, I'd like to add a demo that
allows column resizing and also turns on touch scrolling. I think if I
start with the column resizing demo, the right thing should happen. Any
advice is welcome.
Regarding the change to DOMMouseMoveTracker.js, here's why: The handler is
a capture handler on the body element. The mouseleave event happens when
the mouse leaves any child node of the element the handler is configured
on. So you start handling mousemove, and the moment the mouse leaves the
4px wide handle, _onMouseEnd is called. Lucky _onMouseEnd was misspelled
there, because that could never have worked. I can't think of any reason we
would want to handle mouseleave there, but let me know if there is
something I'm not seeing.
|
Hey David, I'm sorry to hear that, and hope you have a swift recovery. Your explanation of the changes looks good and your idea for the example as well. It may be as simple as flipping a property on. Let's give some time for the folks I tagged to weigh in if they want. Then we can move forward w/ merging. Get well soon & thanks! |
I'm doing the work-from-home thing today, and I should be able to work on
the demo later on.
Thanks!
…On Fri, Jan 19, 2018 at 9:26 PM, Chris Jordan ***@***.***> wrote:
Hey David, I'm sorry to hear that, and hope you have a swift recovery.
Your explanation of the changes looks good and your idea for the example as
well. It may be as simple as flipping a property on.
Let's give some time for the folks I tagged to weigh in if they want. Then
we can move forward w/ merging.
Get well soon & thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#280 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF7c-ozl2wT6kHn61_HaRm8nfslIULPCks5tMWrZgaJpZM4Rc-iI>
.
|
@@ -44,6 +44,7 @@ class ResizeExample extends React.Component { | |||
rowsCount={dataList.getSize()} | |||
onColumnResizeEndCallback={this._onColumnResizeEndCallback} | |||
isColumnResizing={false} | |||
touchScrollEnabled={true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the Resizable Columns demo with this change on:
- Chrome/Android
- Safari/iOS11
- Chrome/Mac (both dev device mode and desktop mode)
- Safari/Mac
- Firefox/Mac
- IE11/Win7
- Edge/Win10
Works correctly everywhere except IE11/Win7, where trying to load that demo gets the error:
SCRIPT1014: Invalid character
File: main.js, Line: 16952, Column: 13
The character referred to is the first backquote in the following line in index.js:
type: `webpack${type}`,
I updated the Resizable Columns demo. |
columnResizerComponent = ( | ||
<div | ||
className={cx('fixedDataTableCellLayout/columnResizerContainer')} | ||
style={columnResizerStyle} | ||
onMouseDown={this._onColumnResizerMouseDown} | ||
onTouchStart={this.props.touchEnabled ? this._onColumnResizerMouseDown : null} | ||
onTouchEnd={this.props.touchEnabled ? e => e.stopPropagation() : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll merge and look to release over the weekend. Thanks
Merged and released w/ 0.8.10 |
Description
event.preventDefault
called as well asevent.stopPropagation
.mouse out
event.Motivation and Context
Release 0.8.8 makes column resize work on iOS, and almost makes column resize work on Android. Our app requires that this feature work on Android.
Fixes #277
I have not modified the width of fixedDataTableCell_columnResizerKnob. Instead, I styled
.public_fixedDataTableCell_columnResizerKnob
in our app, increasing its width to 10px, but styling it with a linear gradient so it doesn't look twice as big.How Has This Been Tested?
I tested this change, using our fork of fixed-data-table, in our app, on the following platforms:
Both column resize and touch scroll are configured.
npm run test
: all succeed.npm run site-dev-server
: all applicable demos work as expected. There really needs to be a demo with both column resize and touch scroll configured. I'm glad to add one, but I have not done so yet.Screenshots (if appropriate):
Types of changes
Checklist: