@algolia/autocomplete-js 1.19.6 → 1.19.7

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.
@@ -4,23 +4,21 @@ export function getPanelPlacementStyle(_ref) {
4
4
  form = _ref.form,
5
5
  environment = _ref.environment;
6
6
  var containerRect = container.getBoundingClientRect();
7
- // Some browsers have specificities to retrieve the document scroll position.
8
- // See https://stackoverflow.com/a/28633515/9940315
9
- var scrollTop = environment.pageYOffset || environment.document.documentElement.scrollTop || environment.document.body.scrollTop || 0;
10
- var top = scrollTop + containerRect.top + containerRect.height;
7
+ var offsetParent = container.offsetParent || environment.document.documentElement;
8
+ var top = container.offsetTop + containerRect.height;
11
9
  switch (panelPlacement) {
12
10
  case 'start':
13
11
  {
14
12
  return {
15
13
  top: top,
16
- left: containerRect.left
14
+ left: container.offsetLeft
17
15
  };
18
16
  }
19
17
  case 'end':
20
18
  {
21
19
  return {
22
20
  top: top,
23
- right: environment.document.documentElement.clientWidth - (containerRect.left + containerRect.width)
21
+ right: offsetParent.clientWidth - (container.offsetLeft + containerRect.width)
24
22
  };
25
23
  }
26
24
  case 'full-width':
@@ -38,8 +36,8 @@ export function getPanelPlacementStyle(_ref) {
38
36
  var formRect = form.getBoundingClientRect();
39
37
  return {
40
38
  top: top,
41
- left: formRect.left,
42
- right: environment.document.documentElement.clientWidth - (formRect.left + formRect.width),
39
+ left: form.offsetLeft,
40
+ right: offsetParent.clientWidth - (form.offsetLeft + formRect.width),
43
41
  width: 'unset',
44
42
  maxWidth: 'unset'
45
43
  };
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-js 1.19.6 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.19.7 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.19.6';
350
+ var version = '1.19.7';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -4834,23 +4834,21 @@
4834
4834
  form = _ref.form,
4835
4835
  environment = _ref.environment;
4836
4836
  var containerRect = container.getBoundingClientRect();
4837
- // Some browsers have specificities to retrieve the document scroll position.
4838
- // See https://stackoverflow.com/a/28633515/9940315
4839
- var scrollTop = environment.pageYOffset || environment.document.documentElement.scrollTop || environment.document.body.scrollTop || 0;
4840
- var top = scrollTop + containerRect.top + containerRect.height;
4837
+ var offsetParent = container.offsetParent || environment.document.documentElement;
4838
+ var top = container.offsetTop + containerRect.height;
4841
4839
  switch (panelPlacement) {
4842
4840
  case 'start':
4843
4841
  {
4844
4842
  return {
4845
4843
  top: top,
4846
- left: containerRect.left
4844
+ left: container.offsetLeft
4847
4845
  };
4848
4846
  }
4849
4847
  case 'end':
4850
4848
  {
4851
4849
  return {
4852
4850
  top: top,
4853
- right: environment.document.documentElement.clientWidth - (containerRect.left + containerRect.width)
4851
+ right: offsetParent.clientWidth - (container.offsetLeft + containerRect.width)
4854
4852
  };
4855
4853
  }
4856
4854
  case 'full-width':
@@ -4868,8 +4866,8 @@
4868
4866
  var formRect = form.getBoundingClientRect();
4869
4867
  return {
4870
4868
  top: top,
4871
- left: formRect.left,
4872
- right: environment.document.documentElement.clientWidth - (formRect.left + formRect.width),
4869
+ left: form.offsetLeft,
4870
+ right: offsetParent.clientWidth - (form.offsetLeft + formRect.width),
4873
4871
  width: 'unset',
4874
4872
  maxWidth: 'unset'
4875
4873
  };