# Bug Report: Button component registers clicks from previous routine

**URL:** <https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134>\
**Category:** Builder\
**Created:** [May 20, 2021, 4:11pm UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134 "2021-05-20T16:11:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan-L](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jan-l/32/16143_2.png) [@Jan-L](https://discourse.psychopy.org/u/Jan-L)\
**Post date:** [May 20, 2021, 4:11pm UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/1 "2021-05-20T16:11:22Z")

</div>

I’m on version 2021.1.4 and encountered a bug with the button component. If two routines following each other have a button in the same spot, and the first button press ends the first routine, then your mouse will still be in the same spot in a pressed state when the next routine starts. This way you will skip all the other routines following the first one immediately, if they have a routine-ending button in the same spot.

Finding that one took me quite a while, in the end I fixed it manually by rebuilding the button code, in a way the ends the routine on button release instead of on button-push.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 20, 2021, 4:37pm UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/2 "2021-05-20T16:37:50Z")

</div>

You should be able to clear events in Begin Routine

Try event.clearEvents() in code component above the Button

---

<div class="post-metadata">

**Author:** ![Jan-L](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jan-l/32/16143_2.png) [@Jan-L](https://discourse.psychopy.org/u/Jan-L)\
**Post date:** [May 20, 2021, 5:23pm UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/3 "2021-05-20T17:23:40Z")

</div>

Thank you, that solution worked as well! But I still would like to report this as a bug, it does not seem like intended behaviour. Do you know where the appropriate place is for that?

---

<div class="post-metadata">

**Author:** ![TParsons](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tparsons/32/8301_2.png) [@TParsons](https://discourse.psychopy.org/u/TParsons)\
**Post date:** [May 21, 2021, 8:25am UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/4 "2021-05-21T08:25:03Z")

</div>

The best place to report bugs is the Issues list on GitHub: [Issues · psychopy/psychopy · GitHub](https://github.com/psychopy/psychopy/issues)

---

<div class="post-metadata">

**Author:** ![Jan-L](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jan-l/32/16143_2.png) [@Jan-L](https://discourse.psychopy.org/u/Jan-L)\
**Post date:** [May 21, 2021, 9:11am UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/6 "2021-05-21T09:11:33Z")

</div>

Thank you, I submitted the issue!

---

<div class="post-metadata">

**Author:** ![Jan-L](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jan-l/32/16143_2.png) [@Jan-L](https://discourse.psychopy.org/u/Jan-L)\
**Post date:** [May 28, 2021, 6:13pm UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/7 "2021-05-28T18:13:44Z")

</div>

Later on I realized, that event.clearEvents() didn’t fix the issue. I accidentally worked around the issue another way (I required that there had to be input on a slider in order to end the routine).

---

<div class="post-metadata">

**Author:** ![alexsunny123](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@alexsunny123](https://discourse.psychopy.org/u/alexsunny123)\
**Post date:** [June 3, 2021, 7:54am UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/8 "2021-06-03T07:54:19Z")

</div>

thanks for the awesome information.

---

<div class="post-metadata">

**Author:** ![alexsunny123](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@alexsunny123](https://discourse.psychopy.org/u/alexsunny123)\
**Post date:** [August 19, 2021, 9:48am UTC](https://discourse.psychopy.org/t/bug-report-button-component-registers-clicks-from-previous-routine/23134/9 "2021-08-19T09:48:17Z")

</div>

> [@Jan-L](#):
>
> Later on I realized, that event.clearEvents() didn’t fix the issue. I accidentally worked around the issue another way (I required that there had to be input on a slider in order to end the routine). [https://ometv.onl](https://ometv.onl) [https://chatroulette.top](https://chatroulette.top)

thanks for the awesome information.
