Bug where the mouse wheel doesn’t work while dragging in a scrollable container
- Symptom
- Affected target: scrollable container
- Symptom details
- While dragging, the mouse wheel event does not work in the scrollable container
- The scrollable container is located between an element with position fixed, absolute, or sticky and an element with position relative
- Browser: macOS Chrome only (It never worked on Windows Chrome in the first place)
- Solution
- Add a style
- Set the style of the element that is at the same level as the element with position fixed, absolute, or sticky, and that contains the scrollable container, to position: ‘sticky’
- With this, wheel scroll works while dragging
- Add a style
- Cause
- Presumed to be a Chrome bug
- position sticky causes a side effect on wheel scroll behavior
- position sticky and position relative affect each other
- Presumed to be a Chrome bug
- Open questions 1. Shouldn’t position: ‘sticky’ only take effect when it’s used together with CSS properties like top, left, etc.? It feels like fixing a bug with another bug, which isn’t very satisfying.
- Runtime environment
| Chrome | 91.0.4472.114 (Official Build) (x86_64) | |||
|---|---|---|---|---|
| Revision | 4bb19460e8d88c3446b360b0df8fd991fee49c0b-refs/branch-heads/4472@{#1496} | |||
| OS | V8 9.1.269.36 | |||
| User Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 | |||
| Command Line | –no-first-run –disable-fre –no-default-browser-check –flag-switches-begin –flag-switches-end about:blank |
20210723
Leave a comment