question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: introduce setting to allow vertical scroll from a child scroll to affect parent

See original GitHub issue

Hi,

in issue #1462 there was a feature request to allow “bubbling” of scroll events from a child container to its parent container. Let’s look at an example:

<ion-content>
  Here be lots of text
  <ion-scroll direction="x">
    Here be a really long line of text, to allow horizontal scrolling...
  </ion-scroll>
  Here be even more text and some dragons.
</ion-content>

Demo: http://codepen.io/anon/pen/BoGkA

Scrolling the ion-scroll horizontally works fine, but as soon as you (accidentally) start your touchDown/mouseDown inside the ion-scroll, you will no longer be able to vertically scroll the ion-content. Sometimes, you have a screen with a really big horizontal scroll element that also needs to be vertically scrollable, which will make scrolling that screen up and down really difficulty, since you mustn’t start your scroll motion inside the horizontal scrolling element. In the aforementioned ticket, the cause for this was found in tap.js Line 154. If I remove the (e.defaultPrevented) condition, I’m able to scroll both the child and the parent at the same time. Since this doesn’t seem to cause any other behaviour problems (I tested it on native Android, iOS browser, desktop browser), it would be great if this specific condition could be turned into a flag that I could set either on the general Ionic Framework or (even better) on each child scroll container. What do you think?

Example: <ion-scroll direction="x" scroll-outside="true">

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:37 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
william-beange-hscommented, Jun 17, 2016

@andmar8 I am having the same problem. Parent vertical scrolling is not working from within child element with horizontal scrolling. I’ve prototyped what I’m trying to achieve here: http://play.ionic.io/app/11a919492a31 You can see the error when trying to scroll down the page from the child lists.

1reaction
sshakeelcommented, Nov 13, 2014

There is a temporary fix for this according to @bra1n

For some reason, the only way to fix it there was to monkey-patch a line in the ionic.bundle.js:

ignoreScrollStart: function(e) { return //(e.defaultPrevented) || // <-- comment out this first condition to have scroll events bubble up

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Prevent scrolling of parent element when inner ...
Basic idea is to bind the wheeling event to the child element, and then use the native javascript property scrollHeight and the jquery...
Read more >
Coupling two ion-scrolls (or setting an element within ... - GitHub
I'm using ion-scroll and ion-content to scroll the x axis of the screen, so you can scroll left to right to see more...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
How to prevent overflow scrolling in CSS - LogRocket Blog
The scroll value of the overflow property adds horizontal and vertical scroll bars so you can adjust or scroll the content if it's...
Read more >
About Scroll Bars - Win32 apps | Microsoft Learn
A vertical scroll bar enables the user to scroll the content up or down. ... scroll bar is to enable the user to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found