@kitconcept/volto-light-theme 7.8.5 → 7.8.6

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/.changelog.draft CHANGED
@@ -1,7 +1,7 @@
1
- ## 7.8.5 (2026-05-11)
1
+ ## 7.8.6 (2026-06-15)
2
2
 
3
3
  ### Bugfix
4
4
 
5
- - Fixed a bug that closed the Navigation when scrolling down with the scrollbar. @ TimoBroeskamp
5
+ - refactor closing logic for fatnav to ignore all clicks on scrollbar @jackahl [#834](https://github.com/kitconcept/volto-light-theme/pull/834)
6
6
 
7
7
 
package/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 7.8.6 (2026-06-15)
12
+
13
+ ### Bugfix
14
+
15
+ - refactor closing logic for fatnav to ignore all clicks on scrollbar @jackahl [#834](https://github.com/kitconcept/volto-light-theme/pull/834)
16
+
11
17
  ## 7.8.5 (2026-05-11)
12
18
 
13
19
  ### Bugfix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitconcept/volto-light-theme",
3
- "version": "7.8.5",
3
+ "version": "7.8.6",
4
4
  "description": "Volto Light Theme by kitconcept",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -45,7 +45,7 @@
45
45
  "release-it": "^19.0.3",
46
46
  "typescript": "^5.7.3",
47
47
  "vitest": "^3.1.2",
48
- "@plone/types": "2.0.0-alpha.18"
48
+ "@plone/types": "1.6.0"
49
49
  },
50
50
  "dependencies": {
51
51
  "@dnd-kit/core": "6.0.8",
@@ -1,6 +1,6 @@
1
1
  // SemanticUI-free pre-@plone/components
2
2
 
3
- import React, { useState, useEffect, useRef } from 'react';
3
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import isEmpty from 'lodash/isEmpty';
6
6
  import { useDispatch, useSelector, shallowEqual } from 'react-redux';
@@ -50,34 +50,6 @@ const Navigation = ({ pathname }) => {
50
50
  const token = useSelector((state) => state.userSession.token, shallowEqual);
51
51
  const items = useSelector((state) => state.navigation.items, shallowEqual);
52
52
 
53
- // this function doesn't close the navigation when clicking the scrollbar
54
- const doesScrollbarContainClick = (e) => {
55
- const clickedVerticalScrollbar =
56
- e.clientX >= document.documentElement.clientWidth &&
57
- e.clientX <= window.innerWidth;
58
-
59
- const clickedHorizontalScrollbar =
60
- e.clientY >= document.documentElement.clientHeight &&
61
- e.clientY <= window.innerHeight;
62
-
63
- return clickedVerticalScrollbar || clickedHorizontalScrollbar;
64
- };
65
-
66
- useEffect(() => {
67
- const handleClickOutside = (e) => {
68
- if (navigation.current && doesNodeContainClick(navigation.current, e))
69
- return;
70
- if (doesScrollbarContainClick(e)) return;
71
- closeMenu();
72
- };
73
-
74
- document.addEventListener('mousedown', handleClickOutside, false);
75
-
76
- return () => {
77
- document.removeEventListener('mousedown', handleClickOutside, false);
78
- };
79
- }, []);
80
-
81
53
  useEffect(() => {
82
54
  if (!hasApiExpander('navigation', getBaseUrl(pathname))) {
83
55
  dispatch(getNavigation(getBaseUrl(pathname), config.settings.navDepth));
@@ -98,10 +70,29 @@ const Navigation = ({ pathname }) => {
98
70
  }
99
71
  };
100
72
 
101
- const closeMenu = (index) => {
73
+ const closeMenu = useCallback(() => {
102
74
  setDesktopMenuOpen(null);
103
75
  setCurrentOpenIndex(null);
104
- };
76
+ }, []);
77
+
78
+ const handleClickOutside = useCallback(
79
+ (e) => {
80
+ if (
81
+ (navigation.current && doesNodeContainClick(navigation.current, e)) ||
82
+ e.target.parentElement === null
83
+ )
84
+ return;
85
+ closeMenu();
86
+ },
87
+ [closeMenu],
88
+ );
89
+
90
+ useEffect(() => {
91
+ document.addEventListener('mousedown', handleClickOutside, false);
92
+ return () => {
93
+ document.removeEventListener('mousedown', handleClickOutside, false);
94
+ };
95
+ }, [handleClickOutside]);
105
96
 
106
97
  useEffect(() => {
107
98
  const handleEsc = (event) => {
@@ -114,6 +105,7 @@ const Navigation = ({ pathname }) => {
114
105
  return () => {
115
106
  window.removeEventListener('keydown', handleEsc);
116
107
  };
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
117
109
  }, []);
118
110
 
119
111
  return (