@commander-services/cmd-dropdown-portal 1.9.6 → 1.10.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": "@commander-services/cmd-dropdown-portal",
3
- "version": "1.9.6",
3
+ "version": "1.10.0",
4
4
  "description": "A cmd dropdown portal component",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -51,14 +51,13 @@ function CmdDropdownPortal(props: CmdDropdownPortalProps): JSX.Element | null {
51
51
  document.getElementById('cmd-modal-body') || document.getElementById('cmd-page-wrapper-body');
52
52
  if (element && (wrapperBody ? isElementFullyVisible(element, wrapperBody) : true)) {
53
53
  const rect = element.getBoundingClientRect();
54
- const maxDropdownHeight = props.maxDropdownHeight || 360; // max dropdown height
54
+ const maxDropdownHeight = props.maxDropdownHeight || 360;
55
55
  const spaceBelow = window.innerHeight - rect.bottom;
56
56
  const left = rect.left;
57
57
  const top = rect.bottom;
58
58
  const width = rect.width;
59
- if (spaceBelow >= maxDropdownHeight || !wrapperBody) {
59
+ if (spaceBelow >= maxDropdownHeight) {
60
60
  setPosition({
61
- // top: rect.bottom + window.scrollY,
62
61
  top,
63
62
  left,
64
63
  width,
@@ -66,13 +65,12 @@ function CmdDropdownPortal(props: CmdDropdownPortalProps): JSX.Element | null {
66
65
  });
67
66
  } else {
68
67
  setPosition({
69
- bottom: window.innerHeight - rect.top - window.scrollY + 3,
68
+ bottom: window.innerHeight - rect.top + 3,
70
69
  left,
71
70
  width,
72
71
  top: undefined,
73
72
  });
74
73
  }
75
- // setPosition({ left, top, width });
76
74
  } else {
77
75
  setPosition(null);
78
76
  }
@@ -99,7 +97,7 @@ function CmdDropdownPortal(props: CmdDropdownPortalProps): JSX.Element | null {
99
97
  ref={clickOutsideRef}
100
98
  data-testid={`cmd-dropdown-portal-${props.elementId}`}
101
99
  style={{
102
- position: 'absolute',
100
+ position: 'fixed',
103
101
  left: position.left,
104
102
  zIndex: 999,
105
103
  ...(position.top !== undefined ? { top: position.top } : {}),