Skip to content

Commit

Permalink
Prevent accidentally triggering a press-and-hold event while scrollin…
Browse files Browse the repository at this point in the history
…g the page. (#75)

Remove typo
  • Loading branch information
daya0576 committed Jan 28, 2025
1 parent 0d3883e commit 7f1c7d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion beaverhabits/frontend/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def __init__(self, habit: Habit, day: datetime.date, value: bool) -> None:

self.on("touchstart", self._mouse_down_event)
self.on("touchend", self._mouse_up_event)
self.on("touchmove", self._mouse_up_event)

def _update_style(self, value: bool):
self.props(
Expand All @@ -161,7 +162,7 @@ async def _async_task(self, e: events.ValueChangeEventArguments):
async def _mouse_down_event(self):
self.hold.clear()
try:
async with asyncio.timeout(0.15):
async with asyncio.timeout(0.2):
await self.hold.wait()
except asyncio.TimeoutError:
await note_tick(self.habit, self.day)
Expand Down
2 changes: 0 additions & 2 deletions beaverhabits/frontend/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

UNHOVER_CHECKBOXES = """\
const elements = document.querySelectorAll('.q-checkbox');
console.log(elements);
elements.forEach(element => {
const mouseOutEvent = new Event('mouseout');
element.addEventListener('mouseout', () => {
console.log('mouseout');
element.dispatchEvent(mouseOutEvent);
});
});
Expand Down

0 comments on commit 7f1c7d4

Please sign in to comment.