@cloud-ru/ds-drawer 1.0.4 → 1.0.5-preview-98332145.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-drawer",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-preview-98332145.0",
4
4
  "description": "Пакет выезжающих панелей — компоненты Drawer и DrawerCustom с едиными токенами позиции и ширины.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,13 +40,13 @@
40
40
  "classnames": "^2.5.1",
41
41
  "react-remove-scroll": "^2.7.2",
42
42
  "tabbable": "^6.5.0",
43
- "@cloud-ru/ds-adaptive": "^1.0.1",
44
- "@cloud-ru/ds-materials": "^1.0.1",
45
- "@cloud-ru/ds-bottom-sheet": "^1.0.3",
46
- "@cloud-ru/ds-scroll": "^1.0.2",
47
- "@cloud-ru/ds-tooltip": "^1.0.3",
48
- "@cloud-ru/ds-popup-private": "^1.0.3",
49
- "@cloud-ru/ds-portal-context": "^1.0.1",
50
- "@cloud-ru/ds-utils": "^1.1.0"
43
+ "@cloud-ru/ds-adaptive": "1.0.1",
44
+ "@cloud-ru/ds-materials": "1.0.1",
45
+ "@cloud-ru/ds-popup-private": "1.0.3",
46
+ "@cloud-ru/ds-bottom-sheet": "1.0.4-preview-98332145.0",
47
+ "@cloud-ru/ds-scroll": "1.0.2",
48
+ "@cloud-ru/ds-portal-context": "1.0.1",
49
+ "@cloud-ru/ds-tooltip": "1.0.3",
50
+ "@cloud-ru/ds-utils": "1.1.0"
51
51
  }
52
52
  }
@@ -84,7 +84,9 @@ function DrawerFrame(props: DrawerCustomProps) {
84
84
  const outerScrollLock = useOuterScrollLock(Boolean(open));
85
85
 
86
86
  // Без явного container портал идёт через PortalContextProvider (как у Modal): скоуп к локальному
87
- // элементу и отказ от body-level scroll lock, который rc-drawer ставит при рендере в document.body.
87
+ // контейнеру вместо document.body. Скролл фона лочит `RemoveScroll` — у `@rc-component/drawer`
88
+ // своего body scroll lock больше нет; wheel по mask / нескроллируемым зонам панели не должен
89
+ // крутить страницу под дровером.
88
90
  const portalContextRef = usePortalContext();
89
91
  const resolvedContainer =
90
92
  container ?? (portalContextRef.current ? () => portalContextRef.current as HTMLElement : undefined);
@@ -119,12 +121,17 @@ function DrawerFrame(props: DrawerCustomProps) {
119
121
  prefixCls='snack-rc-drawer'
120
122
  {...(disableMotions ? {} : motionProps)}
121
123
  >
122
- {/* Свой лок в стеке `react-remove-scroll`: иначе лок модалки-родителя гасит скролл дровера. */}
124
+ {/*
125
+ Свой лок в стеке `react-remove-scroll`: иначе лок модалки-родителя гасит скролл дровера.
126
+ `removeScrollBar={false}` — не ставим `data-scroll-locked` на body (см. useOuterScrollLock).
127
+ Нельзя `display: contents`: capture `onWheel` на contents-узле в части браузеров не
128
+ срабатывает → wheel по search/header/mask уходит в скролл страницы под дровером.
129
+ */}
123
130
  <RemoveScroll
124
131
  enabled={showBlackout || outerScrollLock}
125
132
  removeScrollBar={false}
126
133
  ref={focusTrapRef}
127
- className={styles.focusScope}
134
+ className={styles.scrollLock}
128
135
  >
129
136
  {showButtonClosed && (
130
137
  <div className={styles.showButtonClosedWrapper}>
@@ -44,6 +44,8 @@ $panelMotions: (
44
44
  position: absolute;
45
45
  z-index: initial;
46
46
  inset: 0;
47
+ // Не даём wheel/touch «протечь» к скроллу страницы под маской.
48
+ overscroll-behavior: none;
47
49
 
48
50
  opacity: 1;
49
51
  background-color: base.$sn-theme-color-blackout;
@@ -75,6 +77,8 @@ $panelMotions: (
75
77
 
76
78
  position: relative;
77
79
 
80
+ overflow: hidden;
81
+ overscroll-behavior: none;
78
82
  display: flex;
79
83
  flex-direction: column;
80
84
  flex-grow: 1;
@@ -307,8 +311,19 @@ $panelMotions: (
307
311
  @include m.with-material('acrylic', #{drawer});
308
312
  }
309
313
 
310
- .focusScope {
311
- display: contents;
314
+ .scrollLock {
315
+ // Реальный flex-бокс (не `display: contents`): иначе capture `onWheel` у RemoveScroll
316
+ // в части браузеров не вызывается, и колесо по header/search/пустым зонам крутит фон.
317
+ display: flex;
318
+ flex: 1 1 auto;
319
+ flex-direction: column;
320
+ align-self: stretch;
321
+
322
+ box-sizing: border-box;
323
+ width: 100%;
324
+ min-width: 0;
325
+ height: 100%;
326
+ min-height: 0;
312
327
  }
313
328
 
314
329
  .showButtonClosed {