@lynx-js/web-elements 0.12.8 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.12.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Clamp the `setFoldExpanded` offset of `<x-foldview-ng>` to the scrollable length. ([#3290](https://github.com/lynx-family/lynx-stack/pull/3290))
8
+
9
+ `setFoldExpanded` called the native `scrollTo`, bypassing the clamping done by the
10
+ `scrollTop` setter. A page collapsing its header with a deliberately large offset
11
+ (e.g. `offset: '99999px'`) scrolled past the end, which does not happen on native.
12
+ - Give `<x-foldview-header-ng>` a `width: 100%`. ([#3290](https://github.com/lynx-family/lynx-stack/pull/3290))
13
+
14
+ The element is laid out with `position: absolute` but had no width, so it shrank to
15
+ fit its content instead of filling the foldview.
16
+
3
17
  ## 0.12.8
4
18
 
5
19
  ### Patch Changes
@@ -70,8 +70,10 @@ let XFoldviewNg = (() => {
70
70
  setFoldExpanded(params) {
71
71
  const { offset, smooth = true } = params;
72
72
  const offsetValue = parseFloat(offset);
73
+ // `scrollTo` is the native method and does not go through the `scrollTop`
74
+ // setter above, so the offset has to be clamped here as well.
73
75
  this.scrollTo({
74
- top: offsetValue,
76
+ top: Math.min(Math.max(offsetValue, 0), this[scrollableLength]),
75
77
  behavior: smooth ? 'smooth' : 'instant',
76
78
  });
77
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.12.8",
3
+ "version": "0.12.9",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,6 +59,8 @@ x-foldview-header-ng {
59
59
  order: 2;
60
60
  flex: 0 0 auto;
61
61
  position: absolute;
62
+ /* an out-of-flow box shrinks to fit its content without an explicit width */
63
+ width: 100%;
62
64
  }
63
65
 
64
66
  x-foldview-ng[header-over-slot] > x-foldview-slot-ng,