A click on the table scrolls the page all the way to the top
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Load a page where the table in reachable through scrolling.
- Scroll to the table.
- Click
- Observe the page scrolled all the way to the top.
What is expected?
scrolling shouldn't be affected by the click on the table.
Screenshots or demo
Here's how to try and see:
<html>
<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet/dist/assets/iconfont/iconfont.css' />
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/plugins/js/plugin.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luckysheet/dist/luckysheet.umd.js"></script>
</head>
<body>
<h2>Scroll down please.</h2>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="luckysheet" style="margin:0px;padding:0px;width:90%;height:50%;left: 20px;top: 20px;"></div>
<script>
$(function () {
var options = {
container: 'luckysheet', //luckysheet is the container id
lang: 'en',
title: 'bug'
}
luckysheet.create(options)
})
</script>
</body>
</html>
Environment
- OS: Any
- Browser Version: Issue is observed on chrome, firefox and opera so far.
- Luckysheet Version: The one available on CDN
P.S. Thanks a lot for the beautiful work!
2条答案
按热度按时间kzmpq1sx1#
In order to deal with the problem of Chinese input, clicking the cell will trigger the focus().select() of the input box once, and the initial top value of the input box is -1000px. We have not found a good way yet. If you use it in an English environment, you can change line 482 in the src\utils\util.js file to:
vjrehmav2#
I don't want to edit luckysheet source, so I fix this behaviour as folows: