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

Menu panel swipe open close #606

Merged
merged 6 commits into from Feb 28, 2019
Merged

Conversation

AquiGorka
Copy link
Contributor

@AquiGorka AquiGorka commented Feb 7, 2019

@AquiGorka AquiGorka added the wip label Feb 7, 2019
@AquiGorka AquiGorka changed the title [wip] Menu panel swipe open close Menu panel swipe open close Feb 8, 2019
@bpierre bpierre mentioned this pull request Feb 8, 2019
40 tasks
@AquiGorka AquiGorka removed the wip label Feb 11, 2019
@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch 4 times, most recently from 8b90bc6 to 36bc01c Compare February 11, 2019 15:24
@sohkai sohkai added this to the A1 Sprint: 4.1 milestone Feb 12, 2019
Copy link
Contributor

@bpierre bpierre left a comment

Choose a reason for hiding this comment

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

Looking good! I left some comments.

I wonder if we should detect the touch capability before enabling this behavior? e.g. by checking 'ontouchstart' in document.documentElement. We could also detect iOS and disable it there too, so users are not surprised to have it working one way (to close) but not the other.

Let me know what you think 😊

src/Wrapper.js Outdated Show resolved Hide resolved
src/Wrapper.js Outdated Show resolved Hide resolved
src/Wrapper.js Outdated Show resolved Hide resolved
src/Wrapper.js Outdated Show resolved Hide resolved
src/components/MenuPanel/MenuPanel.js Show resolved Hide resolved
src/Wrapper.js Outdated
(down &&
xDelta &&
yDelta > -THRESHOLD_DISTANCE &&
yDelta < THRESHOLD_DISTANCE &&
Copy link
Contributor

Choose a reason for hiding this comment

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

We should ensure that we haven’t started to drag before doing this check, and stop doing it until the next drag interaction.

Otherwise going horizontal then vertical prevents the panel to move:

Copy link
Contributor Author

@AquiGorka AquiGorka Feb 15, 2019

Choose a reason for hiding this comment

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

I'm not sure how you accomplished such error, I've considered the behavior and checked against it, maybe that first click that seems of the edge spawned some inconsistencies:

Copy link
Contributor

Choose a reason for hiding this comment

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

That’s really weird, in your capture yDelta < THRESHOLD_DISTANCE shouldn’t pass, since you are going below 10px? But in any case, do we need this check at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what the checks for xDelta and xDir are for, to capture "intent" if the user started scrolling horizontally and triggered the open/close, then it doesn't matter if they do vertical movement and the other way around, if they do vertical movement then the drag does not start.

src/Wrapper.js Outdated Show resolved Hide resolved
src/Wrapper.js Outdated
yDelta < THRESHOLD_DISTANCE &&
xDir &&
yDir > -THRESHOLD_DIRECTION &&
yDir < THRESHOLD_DIRECTION)
Copy link
Contributor

@bpierre bpierre Feb 15, 2019

Choose a reason for hiding this comment

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

I’m not sure I understand why the Y part of the direction vector is tested, since we are testing the distance already? For example, users might want to drag the panel in a diagonal, and it should drag the panel anyway.

Or maybe the intention is to test the X velocity, and only start the drag if it is sufficient? In any case, I don’t think we should use one component of a direction vector to do that.

package.json Outdated Show resolved Hide resolved
src/Wrapper.js Outdated Show resolved Hide resolved
@AquiGorka AquiGorka changed the base branch from use-viewport to master February 15, 2019 10:53
@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch 2 times, most recently from 1df8dad to 751f1a5 Compare February 15, 2019 12:13
@sohkai sohkai modified the milestones: A1 Sprint: 4.1, A1 Sprint: 4.2 Feb 18, 2019
@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch 4 times, most recently from fec75ac to cb051d7 Compare February 26, 2019 08:08
@AquiGorka
Copy link
Contributor Author

@sohkai and @bpierre rebased and updated to latest master 😄

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

✨ LGTM!

src/components/MenuPanel/MenuPanel.js Outdated Show resolved Hide resolved
src/components/MenuPanel/MenuPanel.js Show resolved Hide resolved
src/components/MenuPanel/SwipeContainer.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

Actually I just noticed; on the "native" apps, text selection via mouse click + movement is now impossible on desktop since the events are being picked up by the gesture instead :/.

Maybe this is something we should only enable on touch devices?

@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch from cb051d7 to d404e1a Compare February 28, 2019 08:01
@AquiGorka
Copy link
Contributor Author

@sohkai enabled only for touch devices 272cf5d

@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch from 272cf5d to 47fce78 Compare February 28, 2019 08:14
@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch from 47fce78 to c0535dc Compare February 28, 2019 09:46
@AquiGorka AquiGorka force-pushed the feature/menu-panel-swipe-open-close branch from c0535dc to 1b8a7e9 Compare February 28, 2019 09:48
@AquiGorka AquiGorka merged commit 0971441 into master Feb 28, 2019
@AquiGorka AquiGorka deleted the feature/menu-panel-swipe-open-close branch February 28, 2019 15:05
@luisivan luisivan mentioned this pull request Mar 4, 2019
46 tasks
2color added a commit that referenced this pull request Apr 3, 2019
* origin/master: (56 commits)
  Identity - Improve LocalIdentityBadge (#673)
  Menu panel footer separator (#666)
  fix(MenuPanel): avoid clickable margin above system apps toggle (#671)
  Local identities (#656)
  MenuPanel: add toggle animation to show/hide system apps (#658)
  Add github workflow for linting/building (#663)
  Permissions: added system and background app labels (#650)
  Use the same component to render every app icon (#655)
  chore: add all contributors and contributing guidelines (#649)
  Manage the menu button using messages + prevent re-mounting on resize (#651)
  Update melon (#647)
  Apps <> System apps separator (#648)
  Upgrade lint-staged (#646)
  fix: always leave Kernel as first app (#645)
  fix: avoid assigning a registry tag if app is not on a registry (#644)
  chore: upgrade @aragon/wrapper to v4.0.0-beta.1 (#639)
  DaoSettings: add bottom margin on app items (#638)
  Refactor common components (#615)
  Enforce MenuPanel’s width (#636)
  Menu panel swipe open close (#606)
  ...
2color added a commit that referenced this pull request Apr 3, 2019
* origin/master: (55 commits)
  Identity - Improve LocalIdentityBadge (#673)
  Menu panel footer separator (#666)
  fix(MenuPanel): avoid clickable margin above system apps toggle (#671)
  Local identities (#656)
  MenuPanel: add toggle animation to show/hide system apps (#658)
  Add github workflow for linting/building (#663)
  Permissions: added system and background app labels (#650)
  Use the same component to render every app icon (#655)
  chore: add all contributors and contributing guidelines (#649)
  Manage the menu button using messages + prevent re-mounting on resize (#651)
  Update melon (#647)
  Apps <> System apps separator (#648)
  Upgrade lint-staged (#646)
  fix: always leave Kernel as first app (#645)
  fix: avoid assigning a registry tag if app is not on a registry (#644)
  chore: upgrade @aragon/wrapper to v4.0.0-beta.1 (#639)
  DaoSettings: add bottom margin on app items (#638)
  Refactor common components (#615)
  Enforce MenuPanel’s width (#636)
  Menu panel swipe open close (#606)
  ...
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.

None yet

3 participants