Skip to content

useColorSlider should increment/decrement by channel pageSize using PageUp/PageDown #2664

Closed
@majornista

Description

@majornista

🐛 Bug Report

useColorSlider PageUp/PageDown keys increment or decrement by (max-min) / 10, which is the default behavior for a native input. However, color channels have a pageSize that differs depending on the channel. For example, for RGB values the pageSize is 16, a factor of 256, and for Hue, the pageSize is 15, a factor of 360.

  1. Open https://reactspectrum.blob.core.windows.net/reactspectrum/a98461602538bcf63009a17e31900726819a4af6/storybook/index.html?path=/story/colorslider--default
  2. Navigate to the ColorSlider for the Red channel.
  3. Press Home key to set value to 0.
  4. Press PageUp to increment by pageSize.

We also need to ensure that both onChange and onChangeEnd fire with PageUp/PageDown/Home/End

🤔 Expected Behavior

ColorSlider should increment by the pageSize, 16.

😯 Current Behavior

Instead it navigates by 255 / 10, which rounds to 26.

💁 Possible Solution

See #2661 and 4ce326f

🔦 Context

Related to #2570.
Depends on #2661

💻 Code Sample

🌍 Your Environment

Software Version(s)
react-spectrum @react-aria/[email protected]
Browser Chrome version 96.0.4664.55 (Official Build) (x86_64)
Operating System macOS Big Sur version 11.6.1 (20G224)

🧢 Your Company/Team

Adobe/Accessibility

🕷 Tracking Issue (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions