Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TextArea holding on to focus when hidden while doing a mouse selection #4295

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

davep
Copy link
Contributor

@davep davep commented Mar 14, 2024

Discovered by @TomJGooding and similar to #4274 -- if a TextArea was in a mouse selection state and the TextArea was hidden, the selection didn't get ended and so the mouse remained captured by the (now hidden) TextArea.

Fixes #4292.

@davep davep added bug Something isn't working Task labels Mar 14, 2024
@davep davep self-assigned this Mar 14, 2024
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐍 🚀

Comment on lines +1508 to +1512
async def _on_mouse_up(self, event: events.MouseUp) -> None:
"""Finalize the selection that has been made using the mouse."""
self._end_mouse_selection()

async def _on_hide(self, event: events.Hide) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two should definitely be in reverse order. 🙄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did that to be annoying. :-P

@davep davep merged commit 6b8790e into Textualize:main Mar 14, 2024
20 checks passed
@davep davep deleted the ungreedyify-textarea branch March 14, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hiding a TextArea while mouse-based selection is happening can trap the cursor
2 participants