-
Notifications
You must be signed in to change notification settings - Fork 786
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
Hide
event not working as advertised?
#3460
Comments
I think the root of the problem might be here following commit a40300a. If I've understood correctly, won't textual/src/textual/_compositor.py Lines 361 to 368 in 3aaecd3
It looks like the Lines 741 to 746 in 3aaecd3
|
I think so, yes. Widgets with |
Well I've confirmed it wasn't that commit as changing back to I think best left to the experts, but it was interesting digging deeper into Textual! |
I think what is happening is that the sets for shown / hidden / resized ignore the It would be nice if setting visible=False did produce a Worth investigating. |
We need to discuss what the Hide event should do. Right now, the docs says a Hide event will fire when a widget moves off-screen, which feels very wrong to me. I think Hide should only fire when |
The
The logic is somewhat determined by how the compositor is implemented. It uses set operations to very efficiently figure out what is shown / hidden. I'd be interested in understanding why you think it should work differently. Let's have a chat about it tomorrow! |
@darrenburns Does this need any work? |
@willmcgugan Yes, the example in the original post was never fixed. I started "fixing" it, but wasn't sure about the exact intended behaviour. The reason I was unsure was because of all the ways all the ways a widget could go from being visible to not visible - being hidden behind a docked widget, offset pushing it off screen, hidden behind an overlay widget, modal screen etc (also wasn't sure if the compositor handle all of these cases in the hidden/visible sets). This behaviour of a Hide event firing in these situations also felt "wrong" to me in that it was too magical. I expected the Hide event to only fire when visible/display was explicitly set via code, rather than it possibly being sent by some other widget which happens to be rendered above it, hiding it from view. Given all of this it felt better to raise it for discussion instead of guessing. |
Going to park this for now. I think there may be two concepts that are being conflated: Events when widgets come in to the viewport, and events when something is toggled. Until we have a use case we can consider, it is hard to know what the behaviour shoulld be. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
As I read the docs for
Hide
, it's my understanding that this code should show show and hide notifications as I hit the spacebar:but I only ever see show events.
The text was updated successfully, but these errors were encountered: