I'm trying to get data of element on hover with reactjs, but when function starts div scrolls up to top, did someone got similar problem?
I used onMouseOver and onMouseEnter, i tried to save curent scrollTop value, but its glitchy.
My code sample, firstly i thought that there is a problem with rendering div with data, but even when its in position absolute bug occurs.
const ListConteinder = () => {
return (
<div id="filtered-list">
{filteredPosts.sort((a, b) => (a.name > b.name) ? 1 : -1).map((val, key) => {
return (
<label id={val.ID} key={key} className="disable-select list-wrapper list-item" htmlFor={"list-item-" + val.ID}
onMouseOver={(e) => {setDataID(e.target.id); showDetail(true)}}
onMouseLeave={() => showDetail(false)}>
<input type="checkbox" className="list-cb visually-hidden" name={val.ID} id={"list-item-" + val.ID}
onChange={e => {setIsShown(false); handleChange(e)}}></input>
{val.name}
</label>
)
})}
</div>
)};