Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
majornista opened this issue Dec 8, 2021 · 0 comments · Fixed by #2666
Closed

Comments

@majornista
Copy link
Collaborator

🐛 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)

majornista added a commit that referenced this issue Dec 9, 2021
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit that referenced this issue Dec 9, 2021
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.

@trivial fix lint error
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Dec 9, 2021
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit that referenced this issue Dec 9, 2021
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Dec 9, 2021
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
@LFDanLu LFDanLu linked a pull request Dec 15, 2021 that will close this issue
5 tasks
majornista added a commit that referenced this issue Jan 26, 2022
Per https://github.com/adobe/react-spectrum/pull/2666/files#r792201596, verify that Home/PageDown at 0 and End/PageUp at 255 won't cause onChange and onChangeEnd to be called.
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Feb 14, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Feb 18, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Feb 18, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit to majornista/react-spectrum-v3 that referenced this issue Feb 24, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit that referenced this issue Feb 24, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit that referenced this issue Feb 28, 2022
- Omit change events when value doesn't change.
- Refine snapValueToStep for incrementing or decrementing from max.
majornista added a commit that referenced this issue Mar 1, 2022
…Size

If the channel range step is less than 1, like 0.01, and stepSize is not passed as a prop, the slider will always increment or decrement by 1.
majornista added a commit that referenced this issue Mar 3, 2022
majornista added a commit that referenced this issue Mar 3, 2022
snowystinger pushed a commit that referenced this issue Mar 4, 2022
Get colorspace values from the actual colorspace instead of defaults
Remove step from colorfield and colorslider
Fix previous formatted value appearing quickly after blur
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 a pull request may close this issue.

1 participant