Skip to content

iOS: Selection's picker only relinquishes focus for WebView #4563

Description

@hyuri

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

"""
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.iOSThe issue relates to Apple iOS mobile support.

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions