We currently traverse the entire node tree to determine if a particular context is inside a list, for the purpose of showing the state of the list tools, and deciding what action to take when they are used, or what tab is pressed.
What we actually care about is whether the immediate branch node container is a listItem, not the entire tree, for example:
* * # This context thinks it has a bullet list ancestor, but we should only return true for numbered list ancestor
Also a table cell inside a table inside a list reports as having a list ancestor, even though we shouldn't treat that as a list item context. (This is more of an edge case as it shouldn't be possible in normal wikitext)