Skip to content

fix(coordinates): honor an explicit zero swipe/scroll duration - #82

Closed
Atishyy27 wants to merge 1 commit into
google:mainfrom
Atishyy27:fix-swipe-duration-zero
Closed

Atishyy27 wants to merge 1 commit into
google:mainfrom
Atishyy27:fix-swipe-duration-zero

Conversation

@Atishyy27

@Atishyy27 Atishyy27 commented Sep 13, 2026 •

Copy link
Copy Markdown

parse_swipe_parameters picked the duration with an or-chain, so an integer 0 was treated as falsy and replaced by the 800ms default, while the string "0" survived as 0ms. The same value behaved differently by type.

The fix selects the first key whose value is usable as a duration (present, not a boolean, convertible to int). An explicit 0 is honored, empty or invalid values still fall through to the next key, and the duration > duration_ms > time_in_ms precedence holds. Adds unit coverage for parse_swipe_parameters, which had none.

I honored 0 so the int and string paths agree. If you would rather reject duration <= 0 as invalid, happy to switch; either way it makes the two forms consistent.

An integer duration of 0 was treated as falsy by the or-chain in
parse_swipe_parameters and silently replaced with the default (800ms),
while the string "0" was honored as 0ms. Select the first key whose
value is usable as a duration (present, not a bool, and convertible to
int) so an explicit 0 is honored while empty or invalid values still
fall through to the next key. This preserves both the
duration > duration_ms > time_in_ms precedence and the previous
fall-through for unusable values. Adds unit coverage for
parse_swipe_parameters, which had none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant