@graphcommerce/framer-scroller 7.0.0-canary.13 → 7.0.0-canary.21

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,8 +1,28 @@
1
1
  # Change Log
2
2
 
3
- ## 7.0.0-canary.13
3
+ ## 7.0.0-canary.21
4
4
 
5
- ## 7.0.0-canary.12
5
+ ### Major Changes
6
+
7
+ - [#1937](https://github.com/graphcommerce-org/graphcommerce/pull/1937) [`a98e23e3a`](https://github.com/graphcommerce-org/graphcommerce/commit/a98e23e3a250157b9d3756b656f1a4c3c52b0ec0) - Assign correct scroll-snap-type type, to prevent error on firefox ([@mikekeehnen](https://github.com/mikekeehnen))
8
+
9
+ ## 6.2.0-canary.20
10
+
11
+ ## 6.2.0-canary.19
12
+
13
+ ## 6.2.0-canary.18
14
+
15
+ ## 6.2.0-canary.17
16
+
17
+ ## 6.2.0-canary.16
18
+
19
+ ## 6.2.0-canary.15
20
+
21
+ ## 6.2.0-canary.14
22
+
23
+ ## 6.2.0-canary.13
24
+
25
+ ## 6.2.0-canary.12
6
26
 
7
27
  ## 6.2.0-canary.11
8
28
 
@@ -116,7 +116,29 @@ export function ScrollerProvider(props: ScrollerProviderProps) {
116
116
  if (snap.get() === true) return
117
117
  if (scrollerRef.current) scrollerRef.current.style.scrollSnapType = ''
118
118
  snap.set(true)
119
- scroll.animating.set(false)
119
+
120
+ /**
121
+ * There is a bug in Firefox where the actual max scrollLeft isn't the same as the max measured
122
+ * bounds of the elements. If we do not exactly set the correct scrollLeft the scrollLeft is
123
+ * reset to 0 on firefox (instead of chrome/safari where it will snap to the nearest valid
124
+ * position).
125
+ *
126
+ * This can be checked by opening a LayoutOverlay.
127
+ *
128
+ * So we're setting a 'too big' scroll position by an arbitrary amount.
129
+ *
130
+ * To check if it works in a more recent version of FireFox:
131
+ *
132
+ * - Move `scroll.animating.set(false)` outside the requestAnimationFrame
133
+ * - Remove `scrollerRef.current.scrollLeft = prev + 10`
134
+ */
135
+ const prev = scroll.x.get()
136
+ requestAnimationFrame(() => {
137
+ if (scrollerRef.current && Math.round(scrollerRef.current.scrollLeft) !== prev)
138
+ scrollerRef.current.scrollLeft = prev + 10
139
+
140
+ scroll.animating.set(false)
141
+ })
120
142
  }, [snap, scroll])
121
143
 
122
144
  useObserveItems(scrollerRef, items)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/framer-scroller",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "7.0.0-canary.13",
5
+ "version": "7.0.0-canary.21",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -16,13 +16,13 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "popmotion": "11.0.5",
19
- "@graphcommerce/framer-utils": "7.0.0-canary.13",
20
- "@graphcommerce/image": "7.0.0-canary.13"
19
+ "@graphcommerce/framer-utils": "7.0.0-canary.21",
20
+ "@graphcommerce/image": "7.0.0-canary.21"
21
21
  },
22
22
  "devDependencies": {
23
- "@graphcommerce/eslint-config-pwa": "7.0.0-canary.13",
24
- "@graphcommerce/prettier-config-pwa": "7.0.0-canary.13",
25
- "@graphcommerce/typescript-config-pwa": "7.0.0-canary.13"
23
+ "@graphcommerce/eslint-config-pwa": "7.0.0-canary.21",
24
+ "@graphcommerce/prettier-config-pwa": "7.0.0-canary.21",
25
+ "@graphcommerce/typescript-config-pwa": "7.0.0-canary.21"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@mui/material": "^5.10.16",