gyscos / gyscos/cursive

View::take_focus documentation is unclear

Open
#636 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

The documentation for View::take_focus should reflect on the fact that returning `Ok(EventResult::Ignored)` will not grant focus to the view.

```
Attempt to give this view the focus.

source indicates where the focus comes from. When the source is unclear (for example mouse events), Direction::none() can be used.

Returns Ok(_) if the focus was taken. Returns Err(_) if this view does not take focus (default implementation).
```

The above snippet makes it seem like returning Ok(EventResult::Ignored) will grant focus to the view, but experiments show that one should actually return Ok(EventResult::Consumed(_)) to make the view grab focus. Which begs the question: why are there two ways to ignore focus?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.