Repository: slint-ui/slint (language: rust)

Issue:
Children of `Flickable` widgets are included in the accessibility tree when they shouldn't
### Bug Description

Elements contained in a `StandardListView` end up in the accessibility tree even though they are fully hidden. This seem to happen above the list view but not below. I haven't tested horizontally. There seem to have an offset of one item.

## To reproduce

- Run the crud example
- Scroll to the bottom of the list view
- Now you should be able to see with Accessibility Insights for Windows for instance that the first item is still seen above the list view in the accessibility tree. If you scroll to the top, you should observe that the last item is not present below the list view.

### Reproducible Code (if applicable)

Unmodified crud example exhibits the bug. Adding more items to the list as well as a padding at the top of the grid helps demonstrate that only one element seem to escape at most.


### Environment Details

- Slint Version: master branch
- Platform/OS: Windows 11
- Programming Language: Rust
- Backend/Renderer: winit


### Product Impact

_No response_


Discussion / hints:
To explain a bit more the importance of this issue:

List views use the `accessible-delegate-focus` property to indicate where the focus is. It is an index in the list view children. Since not all children are included in the accessibility tree, we currently get a lot of panics where AccessKit sees the focus on a node which does not exist. The `accessible-delegate-focus` property would therefore have to take into account the first visible item, by subtracting the result of `first-visible-item` for instance.

Side note, `first-visible-item` would have to be modified like so to actually return the first visible item (and not the first fully visible item):

```
pure function first-visible-item() -> int {
    return min(root.model.length - 1, max(0, floor(-root.viewport-y / root.item-height)));
}
```

I don't know what's the situation on Qt. If all items are shown at all times over there then two separate paths will be needed.

Fix patch:
diff --git a/internal/core/model.rs b/internal/core/model.rs
index 3eaa6de23e2..03aef2096de 100644
--- a/internal/core/model.rs
+++ b/internal/core/model.rs
@@ -1060,7 +1060,7 @@ impl<C: RepeatedItemTree + 'static> Repeater<C> {
                     c.0 = RepeatedInstanceState::Clean;
                 }
                 let h = c.1.as_ref().unwrap().as_pin_ref().item_geometry(0).height_length();
-                if it_y + h >= zero || new_offset + 1 >= row_count {
+                if it_y + h > zero || new_offset + 1 >= row_count {
                     break;
                 }
                 it_y += h;


Test patch: