This is the heart of the issue introduced by
b48a1402b8
and which is being investigated in
https://github.com/Textualize/textual/issues/1343 -- the child widget can be
focused, but (as far as the author of the code is concerned) it has no
bindings. Bindings for movement-oriented keys exist on the screen which
composes up the widget into it. Up until 0.5.0 this worked just fine. As of
0.6.0, because binding inheritance was introduced, the bindings for movement
that live at the `Widget` level cause the widget that has no bindings to
appear to have bindings.
While this can potentially be worked around with the use of
inherit_bindings, this isn't a very satisfying solution and also breaks the
rule of least astonishment.
This test is going to be key to all of this. This is the test that should be
made to work without breaking any of the other currently-passing tests.
Rather than just test a single specific movement key (in this case "up"), go
with all the affected keys. The cost to doing so is zero and it means we get
a full coverage of testing for all the keys that have become a problem with
0.6.0.
Up until now there doesn't seem to have been any unit tests aimed squarely
at setting up bindings, as part of a running application, which are only
about testing the bindings. As such there was no way of slotting in tests
for how inheritance of bindings works.
This starts that process with a view to testing how inheriting
likely *should* work.
See #1343 for some background to this.
* Get rid of string split key display
* Include screen level bindings when no widget is focused
* Add default key display mappings
* Allow user to customise key display at app level
* Better docstring
* Update CHANGELOG.md
* Add get_child_by_id and get_widget_by_id
* Remove redundant code
* Add unit tests for app-level get_child_by_id and get_widget_by_id
* Remove redundant test fixture injection
* Update CHANGELOG
* Enforce uniqueness of ID amongst widget children
* Enforce unique widget IDs amongst widgets mounted together
* Update CHANGELOG.md
* Ensuring unique IDs in a more logical place
* Add docstring to NodeList._get_by_id
* Dont use duplicate IDs in tests, dont mount 2000 widgets
* Mounting less widgets in a unit test
* Reword error message
* Use lower-level depth first search in get_widget_by_id to break out early
* Improvements to width:auto HorizontalLayout
* Fix HorizontalLayout.get_content_width
* Horizontal width auto improvement
* Removing some printxz
* Update snapshot for horizontal layout width auto dock
This seeks to address #1175, where a containing widget with a transparent
background, but with a border, won't show the border. It seems that at the
heart of the Compositor it's taking `is_transparent` (of the widget) as one
of the indicators that mean that it won't be visible. This wouldn't normally
be the case, in that a widget could be transparent (in the background) but
could have visible content.
Note that some snapshot tests failed with this change, but no material
difference was found in those failing snapshot tests.
Adds a method to Widget that allows moving a child of that widget within its
list of children. Options are to move before or after a specific location,
or a sibling widget.
Seeks to implement #1121.