Skip to content

Commit 52f4343

Browse files
committed
maint(pat scroll box): Document that scroll-down and scroll-up classes are not cleared after scrolling has stopped.
1 parent 640d20d commit 52f4343

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/pat/scroll-box/documentation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Ho(horizontal scrolling is not yet supported.
88

99
The classes are:
1010

11-
- `scroll-up`: when scrolling upwards,
12-
- `scroll-down`: when scrolling downwards,
11+
- `scroll-up`: when scrolling upwards - the class is kept even after scrolling has stopped,
12+
- `scroll-down`: when scrolling downwards - the class is kept even after scrolling has stopped,
13+
- `scrolling-up`: when scrolling upwards - this class is removed after scrolling has stopped,
14+
- `scrolling-down`: when scrolling downwards - this class is removed after scrolling has stopped,
1315
- `scroll-position-top`: when the scrolling container is scrolled to the top,
1416
- `scroll-position-bottom`: when the scrolling container is scrolled to the bottom.

src/pat/scroll-box/scroll-box.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export default Base.extend({
6262
const to_add = [];
6363

6464
if (scroll_pos < this.last_known_scroll_position) {
65-
to_add.push("scroll-up");
6665
to_add.push("scroll-up");
6766
to_add.push("scrolling-up");
6867
} else if (this.last_known_scroll_position < scroll_pos) {
@@ -101,6 +100,8 @@ export default Base.extend({
101100
},
102101

103102
clear_scrolling_classes() {
103+
// Remove ``scrolling-up`` and ``scrolling-down``
104+
// but keep ``scroll-up`` and ``scroll-down``.
104105
this.el.classList.remove("scrolling-up", "scrolling-down");
105106
},
106107

src/pat/scroll-box/scroll-box.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ describe("pat-scroll-box", function () {
8080
expect(el.classList).not.toContain("scrolling-down");
8181

8282
// Test for clearing the scrolling classes after a scroll stop
83+
// scroll-up and scroll-down are not cleared.
84+
8385
// Still there...
8486
await utils.timeout(custom_timeout / 2);
8587
expect(el.classList).toContain("scrolling-up");

0 commit comments

Comments
 (0)