mukilan · GitHub

The spec for [requestDevice] states that the picker must be shown
even when the scan finds no matching devices. The current logic
assumes that there is at least one device to pick from and panics
when the list of devices is empty.
Fix this by explictly handling the case with empty device list.
The new logic displays an empty drop-down and also disables the
'Ok' button when there are no devices to choose from. This also
matches thek behaviour of Chrome's picker.
There were other issues found during testing - the `Escape` and
`Enter` keys don't work. These are pre-existing issues and not
addressed in this patch.
Testing: Manually tested as there are no tests for servoshell.
Fixes: servo#45313
[requestDevice]: https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

@mukilan

mrobinson

@mukilan

@mukilan

TG199 pushed a commit to TG199/servo that referenced this pull request

Jun 21, 2026
…ervo#45702)
The spec for [requestDevice] states that the picker must be shown even
when the scan finds no matching devices. The current logic assumes that
there is at least one device to pick from and panics when the list of
devices is empty.
Fix this by explictly handling the case with empty device list. The new
logic displays an empty drop-down and also disables the 'Ok' button when
there are no devices to choose from. This also matches the behaviour of
Chrome's picker.
There were other issues found during testing - the `Escape` and `Enter`
keys don't work. These are pre-existing issues and not addressed in this
patch.
Testing: Manually tested as there are no tests for servoshell.
Fixes: servo#45313
[requestDevice]:
https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

Read the original on github.com ↗