@faststore/ui 1.6.25 → 1.6.28

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/dist/ui.esm.js CHANGED
@@ -1745,9 +1745,11 @@ const useDropdownPosition = () => {
1745
1745
  } = useDropdown();
1746
1746
  const buttonRect = dropdownButtonRef == null ? void 0 : (_dropdownButtonRef$cu = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu.getBoundingClientRect();
1747
1747
  const topLevel = (_buttonRect$top = buttonRect == null ? void 0 : buttonRect.top) != null ? _buttonRect$top : 0;
1748
- const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
1749
- const topPosition = topLevel + topOffset;
1750
- const leftPosition = (_buttonRect$left = buttonRect == null ? void 0 : buttonRect.left) != null ? _buttonRect$left : 0;
1748
+ const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0; // The scroll properties fix the position of DropdownMenu when the scroll is activated.
1749
+
1750
+ const topPosition = topLevel + topOffset + document.documentElement.scrollTop;
1751
+ const leftLevel = (_buttonRect$left = buttonRect == null ? void 0 : buttonRect.left) != null ? _buttonRect$left : 0;
1752
+ const leftPosition = leftLevel + document.documentElement.scrollLeft;
1751
1753
  return {
1752
1754
  position: 'absolute',
1753
1755
  top: topPosition,
@@ -1820,16 +1822,16 @@ const DropdownMenu = ({
1820
1822
  };
1821
1823
 
1822
1824
  const handleBackdropKeyDown = event => {
1823
- if (event.defaultPrevented) {
1825
+ if (event.defaultPrevented || event.key === 'Enter') {
1824
1826
  return;
1825
1827
  }
1826
1828
 
1829
+ event.preventDefault();
1827
1830
  event.key === 'Escape' && handleEscapePress();
1828
1831
  event.key === 'ArrowDown' && handleDownPress();
1829
1832
  event.key === 'ArrowUp' && handleUpPress();
1830
1833
  event.key === 'Home' && handleHomePress();
1831
1834
  event.key === 'End' && handleEndPress();
1832
- event.key === 'Tab' && event.preventDefault();
1833
1835
  event.stopPropagation();
1834
1836
  };
1835
1837