beeware / beeware/toga

iOS: Selection's picker only relinquishes focus for WebView

Open
#4,563 3 comments 0 reactions 0 assignees View on GitHub
bug iOS
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
9h 45m
Merged PRs (30d)
58

Description

### Describe the bug

Once a Selection widget has focus, which opens a picker, tapping outside of it never closes the picker — the focus is never relinquished, it seems to me — except if you tap on a WebView. Tapping on a WebView does close the picker.

No "Done" button appears anywhere.

Tapping on one of the options in the picker, or pressing Esc or Enter, don't close the picker either.

Tested on the iOS Simulator.

### How to reproduce the bug

1. Add a functional Selection widget (or run the attached minimal code example)
2. Run the app on iOS (tested on the Simulator)
3. Tap on the Selection widget — the picker should open
4. Tap any area outside the picker that's not a WebView
5. Notice he picker never closes

if you repeat the process but you tap on a WebView, the picker does close.

### Minimum example code

```shell
"""
My first application
"""

import toga

class HelloWorld(toga.App):
def startup(self):
self.main_box = toga.Box(
style = toga.style.Pack(direction = 'column'),
children = [
# WebView
toga.Box(
style = toga.style.Pack(background_color = "#424242", flex = 1, direction = 'column'),
children = [
toga.Label(
text = "WebView",
style = toga.style.Pack(color = "#FFFFFF")
),
toga.WebView(
style = toga.style.Pack(margin = 8, flex = 1),
url = "https://beeware.org",
),
]
),

toga.Label(
text = "Non-WebView"
),

# Spacer
toga.Box(
style = toga.style.Pack(flex = 1),
),

# Selection
toga.Selection(
items=[
{"name": "Alice", "age": 37},
{"name": "Bob", "age": 42},
{"name": "Charlie", "age": 24},
],
accessor="name",
),

# Spacer
toga.Box(
style = toga.style.Pack(height = 40),
),
]
)

self.main_window = toga.MainWindow(
title = self.formal_name,
content = self.main_box,
)
self.main_window.show()

def main():
return HelloWorld()
```

### Screenshots

_No response_

### Environment details

- Operating system and version: macOS 15.7.4
- Python version: 3.13.13
- Software versions:
- Briefcase: 0.4.4
- Toga: 0.5.6
- iOS Simulator: 26.0 (1062.1)
- Device + iOS Version: iPhone Air / iOS 26.3 (Simulator)
- SimulatorKit: 954.5
- CoreSimulator: 1051.17.8

### Logs

```

```

### Additional context

1. Only tested on the iOS Simulator. I don't know if the problem exists on a real device.
2. AI told me the convention on the iOS side is applying a global ".endEditing:YES" on the touch layer (enabled for every widget on Toga side, including the currently-selected option but not the rest in the open picker, I suppose), but I can't personally attest to that.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the provided minimal Selection and WebView example on the iOS Simulator. Trace the iOS Selection picker focus and dismissal path, comparing taps on WebView with taps on other widgets. Done means tapping outside the picker, choosing an option, or pressing Esc or Enter reliably dismisses it, with regression coverage for the reported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, python
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.