The overscroll-behavior-y property controls what happens when a scrollable element reaches its vertical edge. It is essential for modals, chat panels, feed lists, and any nested area that scrolls up and down inside a larger page.
The overscroll-behavior-y property in CSS is used to control the behavior of a scrolling container when the scroll position reaches the edge of the content along the vertical axis.
This property is particularly useful for preventing the default “bounce” or “pull-to-refresh” behavior on touch devices or when working with nested scrollable elements. By setting this property, developers can enhance the user experience by providing a more controlled and consistent scrolling behavior.
By customizing the overscroll behavior, developers can prevent unexpected scrolling actions, such as scrolling the entire page when reaching the end of a nested scrollable element.
Definition and Usage
Use overscroll-behavior-y on elements that scroll vertically inside a larger page, such as modal bodies, chat panels, off-canvas drawers, and nested feed lists.
Pair it with overflow-y: auto or overflow: auto so the element actually scrolls on the vertical axis. Then set overscroll-behavior-y: contain to keep vertical edge scrolling inside that box.
The overscroll-behavior shorthand sets both physical axes at once. In horizontal writing modes, overscroll-behavior-block is the logical equivalent of the vertical axis. Use overscroll-behavior-x when you need to control horizontal overscroll separately.
💡
Beginner Tip
Create a 300px-wide, 200px-tall box with 400px-tall content and overflow: auto;. Scroll to the bottom edge and keep scrolling to feel vertical scroll chaining, then add overscroll-behavior-y: contain;.
Foundation
📝 Syntax
The syntax for the overscroll-behavior-y property is straightforward and can be applied to any scrollable container.
syntax.css
element{overscroll-behavior-y:value;}
It can be applied to any scrollable element. Here, value can be one of the predefined keywords described below.
The element must be scrollable on the vertical axis, usually with overflow-y: auto or overflow: auto.
overscroll-behavior is a shorthand for overscroll-behavior-x and overscroll-behavior-y.
In horizontal writing mode, overscroll-behavior-block maps to the same axis as overscroll-behavior-y.
contain is the most common choice for modal bodies, chat panels, and nested vertical scroll lists.
Defaults
🎯 Default Value
The default value of the overscroll-behavior-y property is auto. This means the default scroll behavior of the browser will occur when the scroll reaches the edge of the content.
With auto, scrolling past the top or bottom edge of a nested scroll area may chain to the page behind it or trigger platform-specific bounce effects.
The default behavior of the browser is maintained. Scroll events are propagated normally.
contain
overscroll-behavior-y: contain;
The scroll behavior is contained within the element. The element does not allow scrolling beyond the boundaries, and the default bounce or pull-to-refresh behavior is disabled.
none
overscroll-behavior-y: none;
All scroll overflow effects are disabled. The element does not allow any scroll chaining or scroll overflow effects.
auto — defaultcontain — stop chainingnone — no bounce
Preview
👀 Live Preview
Three scroll boxes with the same tall gradient content and different overscroll-behavior-y values. Scroll each box to its top or bottom edge:
auto
contain
none
Hands-On
Examples Gallery
Prevent vertical scroll overflow with contain, compare default auto behavior, disable vertical bounce and pull-to-refresh with none, and isolate scroll inside a modal or chat body.
🔄 Vertical Containment
Use overscroll-behavior-y: contain when vertically scrollable areas should not scroll the page behind them.
Example 1 — Scrollable Container with contain
In this example, we prevent the vertical scroll overflow behavior on a container element.
In this example, the .scroll-container has a fixed height with overflow enabled. The overscroll-behavior-y: contain; property ensures that the user cannot scroll beyond the top or bottom of the container, preventing the default bounce effect.
Example 2 — Default auto Behavior
With overscroll-behavior-y: auto, the browser keeps its normal vertical overscroll behavior, including scroll chaining where supported.
Section two — keep reading until you reach the bottom edge.
Section three — at the edge, extra scroll may move the page.
Section four — that is normal default browser behavior.
How It Works
When the panel hits its vertical scroll boundary, the browser may pass the scroll gesture to the page behind it.
🚫 Bounce & Vertical UI
Disable vertical bounce and pull-to-refresh with none or isolate vertical scroll inside modal and chat layouts.
Example 3 — Disable Vertical Overscroll with none
Use overscroll-behavior-y: none when you want to stop both vertical scroll chaining and overscroll bounce effects. On mobile, this can also help prevent pull-to-refresh when overscrolling at the top of a nested panel.
Neither the feed panel nor the page responds to vertical overscroll actions at the container edges, and pull-to-refresh is less likely to trigger on touch devices.
Example 4 — Modal or Chat Scroll Body
Keep nested vertical scroll inside a modal or chat body with overscroll-behavior-y: contain so the page behind stays still.
Casey: Test on mobile too; pull-to-refresh should not steal the gesture.
Alex: Scroll this panel to the top or bottom and keep scrolling.
Jordan: The page behind should stay put.
How It Works
The modal or chat body scrolls independently on the vertical axis while edge scrolling does not move the page behind the overlay.
Companion
overscroll-behavior vs block vs x
The overscroll-behavior shorthand sets both physical axes at once. overscroll-behavior-y targets only the vertical axis (top and bottom), and overscroll-behavior-x targets only the horizontal axis (left and right). In horizontal writing modes, overscroll-behavior-block is the logical equivalent of the vertical axis.
scroll-companion.css
/* Shorthand — both physical axes */.modal-body{overscroll-behavior:contain;}/* Vertical axis only */.chat-panel{overscroll-behavior-x:auto;overscroll-behavior-y:contain;}
A11y
♿ Accessibility
Do not trap users — Preventing vertical scroll chaining is helpful in modals and chat panels, but ensure keyboard users can still scroll nested regions with arrow keys or focus management.
Keep scrollable regions discoverable — Pair overscroll control with visible scroll cues and sufficient contrast on vertically scrollable content.
Prefer contain on modal bodies — so background page movement does not disorient screen reader users when scrolling nested panels.
Test touch devices — Vertical overscroll behavior is especially noticeable on swipe gestures in modals, drawers, and chat interfaces.
🧠 How overscroll-behavior-y Works
1
User scrolls vertically
A modal body, chat panel, or feed list scrolls up and down while content fits inside its bounds.
Scroll
2
Scroll reaches the top or bottom edge
The inner container can scroll no farther up or down on the vertical axis.
Boundary
3
overscroll-behavior-y is applied
The browser decides whether to chain vertical scroll, bounce, or stop at the container edge.
Value
=
🔄
Controlled vertical overscroll
Vertically scrollable panels stay isolated from the page behind them when you use contain or none on the Y axis.
Compatibility
Browser Compatibility
The overscroll-behavior-y property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Edge, and Opera. Safari support has improved in recent versions, but testing across different browsers is recommended for consistent behavior.
✓ Baseline · Modern browsers
Strong support in current browsers
auto, contain, and none work reliably in all major evergreen browsers. Modern Safari has improved support compared to older releases.
95%Global browser support
Google Chrome63+ · 2017 onward
Full support
Mozilla Firefox59+ · 2018 onward
Full support
Apple Safari16+ · macOS & iOS
Improved support
Microsoft Edge18+ · Chromium Edge
Full support
Opera50+ · 2018 onward
Full support
overscroll-behavior-y property95% supported
Bottom line:overscroll-behavior-y is dependable for vertical scroll UX in modern projects. Test on Safari and mobile browsers to confirm bounce and pull-to-refresh behavior.
Wrap Up
Conclusion
The overscroll-behavior-y property provides developers with greater control over the scrolling behavior of web pages and applications.
By using this property, you can create a smoother and more predictable scrolling experience, especially on touch devices. Experiment with the different values to see how they affect your layout and user interactions.
Use overscroll-behavior-y: contain on modal bodies, chat panels, and nested feed lists
Pair with overflow-y: auto or overflow: auto
Test scroll edges on touch devices and trackpads with vertical gestures
Use none when vertical bounce or pull-to-refresh feels distracting on nested panels
Combine with the overscroll-behavior shorthand when both axes need the same value
❌ Don’t
Expect overscroll control without a vertically scrollable container
Apply none everywhere when contain is enough
Confuse overscroll-behavior-y with overflow-y
Forget keyboard navigation for vertically scrollable regions
Skip cross-browser testing on Safari and mobile Chrome
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about overscroll-behavior-y
Use these points when vertically scrollable areas reach their edges.
5
Core concepts
🔄01
Physical Y Axis
Top and bottom edges.
Purpose
⚙02
Default auto
Browser defaults.
Default
📝03
Three Values
auto to none.
Values
🚫04
contain Modals
Stop vertical chaining.
Use case
↕05
Shorthand Pair
X + Y axes.
Companion
❓ Frequently Asked Questions
overscroll-behavior-y controls what happens when a scrollable element reaches its vertical boundary, such as whether up-down scroll chains to a parent or triggers bounce and pull-to-refresh effects.
The default value is auto, which means the browser uses its normal overscroll behavior on the vertical axis, including scroll chaining where supported.
overscroll-behavior-y targets the physical vertical axis (top and bottom). overscroll-behavior-x targets the physical horizontal axis. overscroll-behavior-block is the logical equivalent of the vertical axis in horizontal writing modes. The overscroll-behavior shorthand sets both x and y at once.
Use contain to stop vertical scroll chaining while still allowing local bounce effects. Use none when you also want to disable vertical bounce and prevent actions like pull-to-refresh on mobile.
Yes. Modern mobile browsers support overscroll-behavior-y, which is especially useful for modals, chat panels, and nested scroll areas where vertical overscroll should not move the page behind.