@ticketboothapp/booking 1.2.39 → 1.2.41

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": "@ticketboothapp/booking",
3
- "version": "1.2.39",
3
+ "version": "1.2.41",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -1423,26 +1423,11 @@ export function BookingFlow({
1423
1423
  return null;
1424
1424
  };
1425
1425
 
1426
- const detectedScrollParent = findScrollParent(el);
1427
- const explicitScrollContainer = contentRef?.current ?? null;
1428
- const isElementScrollable = (node: HTMLElement | null): node is HTMLElement => {
1429
- if (!node) return false;
1430
- const style = getComputedStyle(node);
1431
- const allowsScroll = style.overflowY === 'auto' || style.overflowY === 'scroll' || style.overflowY === 'overlay';
1432
- return allowsScroll && node.scrollHeight > node.clientHeight + 1;
1433
- };
1434
-
1435
- // Deterministic host-aware choice:
1436
- // 1) explicit contentRef when it is truly scrollable
1437
- // 2) nearest detected scroll parent when it is truly scrollable
1438
- // 3) window scroll
1439
- const scrollParent =
1440
- !useWindowScroll && isElementScrollable(explicitScrollContainer)
1441
- ? explicitScrollContainer
1442
- : !useWindowScroll && isElementScrollable(detectedScrollParent)
1443
- ? detectedScrollParent
1444
- : null;
1445
- const scrollTarget = scrollParent ?? (typeof window !== 'undefined' ? window : null);
1426
+ const scrollParent = findScrollParent(el);
1427
+ const scrollTarget =
1428
+ useWindowScroll || !scrollParent
1429
+ ? (typeof window !== 'undefined' ? window : null)
1430
+ : scrollParent;
1446
1431
 
1447
1432
  let ticking = false;
1448
1433
  const COOLDOWN_MS = 600; // After a state change, ignore reverse changes for this long (covers 0.25s collapse animation + layout settle)
@@ -166,36 +166,8 @@ export function ItineraryBox({
166
166
  const handlePickupLocationClick = () => {
167
167
  const pickupSection = document.getElementById('pickup-location-section');
168
168
  if (!pickupSection) return;
169
-
170
- const findScrollParent = (node: HTMLElement): HTMLElement | null => {
171
- let parent = node.parentElement;
172
- while (parent) {
173
- const { overflowY } = getComputedStyle(parent);
174
- if (overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay') return parent;
175
- parent = parent.parentElement;
176
- }
177
- return null;
178
- };
179
-
180
- const scrollParent = useWindowScroll ? null : findScrollParent(pickupSection);
181
- const itineraryBox = document.querySelector('[class*="sticky top-"]');
182
- const itineraryHeight = itineraryBox?.getBoundingClientRect().height ?? 0;
183
- // Extra offset so sticky header doesn't block the pickup section (mobile needs more clearance)
184
- const STICKY_HEADER_CLEARANCE = isMobile ? 280 : 270;
185
- const targetOffsetFromTop = itineraryHeight + 16 + STICKY_HEADER_CLEARANCE;
186
-
187
- if (scrollParent) {
188
- const elementPosition = pickupSection.getBoundingClientRect().top;
189
- const scrollDelta = elementPosition - targetOffsetFromTop;
190
- scrollParent.scrollTo({
191
- top: Math.max(0, scrollParent.scrollTop + scrollDelta),
192
- behavior: 'smooth',
193
- });
194
- } else if (typeof window !== 'undefined') {
195
- const elementPosition = pickupSection.getBoundingClientRect().top + window.scrollY;
196
- const scrollTop = Math.max(0, elementPosition - targetOffsetFromTop);
197
- window.scrollTo({ top: scrollTop, behavior: 'smooth' });
198
- }
169
+ // Let browser handle the active scroll container (window or nested dialog/content area).
170
+ pickupSection.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });
199
171
  };
200
172
 
201
173
  const getDisplayLabel = (label: string): string => {