@startlibs/components 1.1.3 → 1.1.4
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
|
@@ -121,6 +121,9 @@ export const usePositioning = (
|
|
|
121
121
|
setTimeout(()=>setPosition(retry+1),100)
|
|
122
122
|
return
|
|
123
123
|
}
|
|
124
|
+
// Limpar a largura para medir pode encurtar o conteúdo (itens deixam de quebrar linha)
|
|
125
|
+
// e o browser corta o scrollTop; guarda para restaurar depois de reaplicar a largura.
|
|
126
|
+
const previousScrollTop = element.current.scrollTop
|
|
124
127
|
if (keepWidth) {
|
|
125
128
|
element.current.style.width = ''
|
|
126
129
|
} else {
|
|
@@ -233,6 +236,9 @@ export const usePositioning = (
|
|
|
233
236
|
if (fixed) {
|
|
234
237
|
element.current.style.position = 'fixed'
|
|
235
238
|
}
|
|
239
|
+
if (element.current.scrollTop !== previousScrollTop) {
|
|
240
|
+
element.current.scrollTop = previousScrollTop
|
|
241
|
+
}
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
useLayoutEffect(setPosition, [on])
|