You've already forked ivan-torvalds-GuitarPedal
forked from AllSpiceMirrors/torvalds-GuitarPedal
Click one slider, then scroll over a different one: the second one
moves, and the ring stays on the first. It was pointing at the wrong
control.
Two notions of "the active pot" had ended up sharing one indicator.
Keyboard focus followed clicks; the wheel followed gesture ownership,
decided by what the pointer was over when the scroll began. Those
agreed while focus was what armed the wheel, and stopped agreeing when
the wheel was changed to work on hover - the ring was drawn for the
first design and outlived it.
So make it one notion: when a gesture takes ownership of a zone, move
the focus to the slider that zone drives. The ring then always names
the thing the wheel is about to change, and the arrow keys act on
whatever you last scrolled, which is the behaviour you would have
guessed at anyway.
focus({ preventScroll: true }) rather than a plain focus(), because the
default is to scroll the element into view and doing that in the middle
of a scroll fights the user for the gesture they are already making.
Scrolling somewhere that is not a pot leaves the focus alone: the wheel
is not driving anything then, so the ring is still telling the truth
about where the arrow keys go.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>