feat: add touch emulation to Page#set_viewport's mobile: option - #618
Merged
Conversation
Closed
route
force-pushed
the
mobile-emulation-527
branch
2 times, most recently
from
August 24, 2026 20:15
e4096ce to
43adefc
Compare
`set_viewport(mobile: true)` already overrode device metrics via
`Emulation.setDeviceMetricsOverride`; this adds the matching
`Emulation.setTouchEmulationEnabled` call, so `mobile: true` fully
covers mobile-viewport interpretation and touch emulation together.
`width`/`height` now default to `0`, matching their documented
"0 disables the override" semantics, so mobile/touch can be enabled
on its own at the page's current size:
page.set_viewport(mobile: true)
Deliberately does not add a `Browser.new(mobile:)` option, a device
size/scale preset, or a user agent: callers can already instantiate
the browser and call `set_viewport` whenever they want, and device
presets/UA are orthogonal concerns better left to the caller.
Does not touch `Page#resize` either: it's Capybara's generic
window-resize hook, unrelated to device emulation.
Co-authored-by: Duncan Bayne <duncan@bayne.id.au>
route
force-pushed
the
mobile-emulation-527
branch
from
August 24, 2026 20:23
43adefc to
ab8a1b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
set_viewport(mobile: true)already overrode device metrics viaEmulation.setDeviceMetricsOverride; this adds the matchingEmulation.setTouchEmulationEnabledcall, somobile: truefully covers mobile-viewport interpretation and touch emulation together.