beeware / beeware/toga

Readonly Textinput beeps on focus loss with keyboard on GTK

Open
#2,554 6 comments 0 reactions 0 assignees View on GitHub
bug good first issue gtk linux
Dominant language
Python
Stars
5.4k
Forks
829
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### Describe the bug

Under GTK, If a readonly text input loses focus as a result of keyboard input (i.e., pressing tab), a beep is emitted.

### Steps to reproduce

1. Run Tutorial 1
2. Type Tab twice

A beep will be emitted when the Celsius field loses focus.

### Expected behavior

No beep should be emitted.

### Screenshots

_No response_

### Environment

- Operating System: Ubuntu 22.04
- Python version: All
- Software versions:
- Toga: 0.4.2+

### Logs

```

```

### Additional context

No beep is emitted on *loss* of focus.

It's arguable whether the readonly widget should be able to accept focus at all - that's the behavior on macOS. If this is acceptable, calling `native.set_can_focus()` as part of `set_readonly()` might be a fix for this.

There is likely similar issues on any other widget with a clear input focus and a readonly option.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by running Tutorial 1 on Ubuntu 22.04 and pressing Tab twice, then inspect the readonly text input's native focus handling. Consider the mentioned set_can_focus() path and check whether other readonly widgets show the same behavior. Done means keyboard focus changes no longer emit a beep.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.