textual
textual copied to clipboard
`SelectionList.select` doesn't post `SelectionToggled` message
Alright, now I know where I went wrong: When looking into textual's code again I found out that SelectionList.toggle triggers the event while SelectionList.select does not. I only tried out SelectionList.select before :(
Originally posted by @jvllmr in https://github.com/Textualize/textual/discussions/4397#discussioncomment-9031924
We found the following entries in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This is an automated reply, generated by FAQtory
Looking at this now.
Spotted a couple of issues relating to the messages in SelectionList, so going to do a pass over it and try to make sure it's posting the right stuff from the various different methods it offers.
I actually believe this is just some lacking documentation.
The semantics of toggle is just that it was explicitly toggled i.e. using the keyboard or a toggle call. The original poster is just handling the wrong event.
I've made the semantics clearer inside docstrings (and also ensured that Toggled messages are sent when toggle_all is used).
Related PR: https://github.com/Textualize/textual/pull/4759