@reykjavik/hanna-react 0.10.126 → 0.10.127
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.md +6 -0
- package/MainMenu2.js +4 -2
- package/esm/MainMenu2.js +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/MainMenu2.js
CHANGED
|
@@ -126,12 +126,14 @@ const MainMenu2 = (props) => {
|
|
|
126
126
|
document.addEventListener('keydown', escHandler);
|
|
127
127
|
};
|
|
128
128
|
const closeMenu = () => {
|
|
129
|
+
var _a;
|
|
129
130
|
htmlCl.remove(globalClasses.menuIsOpen);
|
|
130
131
|
htmlCl.add(globalClasses.menuIsClosed);
|
|
131
132
|
setIsMenuOpen(false);
|
|
132
133
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
133
134
|
setActiveSubmenu(defaultActive);
|
|
134
|
-
|
|
135
|
+
// closeMenu is called on umount, and then the ref might be null
|
|
136
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
|
|
135
137
|
document.removeEventListener('keydown', escHandler);
|
|
136
138
|
};
|
|
137
139
|
(0, react_1.useEffect)(() => {
|
|
@@ -140,8 +142,8 @@ const MainMenu2 = (props) => {
|
|
|
140
142
|
}
|
|
141
143
|
htmlCl.add(globalClasses.menuIsClosed);
|
|
142
144
|
return () => {
|
|
143
|
-
closeMenu();
|
|
144
145
|
htmlCl.remove(globalClasses.menuIsClosed);
|
|
146
|
+
closeMenu();
|
|
145
147
|
};
|
|
146
148
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
147
149
|
}, [isBrowser]);
|
package/esm/MainMenu2.js
CHANGED
|
@@ -122,12 +122,14 @@ export const MainMenu2 = (props) => {
|
|
|
122
122
|
document.addEventListener('keydown', escHandler);
|
|
123
123
|
};
|
|
124
124
|
const closeMenu = () => {
|
|
125
|
+
var _a;
|
|
125
126
|
htmlCl.remove(globalClasses.menuIsOpen);
|
|
126
127
|
htmlCl.add(globalClasses.menuIsClosed);
|
|
127
128
|
setIsMenuOpen(false);
|
|
128
129
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
129
130
|
setActiveSubmenu(defaultActive);
|
|
130
|
-
|
|
131
|
+
// closeMenu is called on umount, and then the ref might be null
|
|
132
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, 0);
|
|
131
133
|
document.removeEventListener('keydown', escHandler);
|
|
132
134
|
};
|
|
133
135
|
useEffect(() => {
|
|
@@ -136,8 +138,8 @@ export const MainMenu2 = (props) => {
|
|
|
136
138
|
}
|
|
137
139
|
htmlCl.add(globalClasses.menuIsClosed);
|
|
138
140
|
return () => {
|
|
139
|
-
closeMenu();
|
|
140
141
|
htmlCl.remove(globalClasses.menuIsClosed);
|
|
142
|
+
closeMenu();
|
|
141
143
|
};
|
|
142
144
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
143
145
|
}, [isBrowser]);
|