Skip to content

UI: Zoom faster when pressing shift#34185

Merged
Sidnioulz merged 5 commits into
nextfrom
sidnioulz/103-qa-zoom-shift
Mar 18, 2026
Merged

UI: Zoom faster when pressing shift#34185
Sidnioulz merged 5 commits into
nextfrom
sidnioulz/103-qa-zoom-shift

Conversation

@Sidnioulz
Copy link
Copy Markdown
Contributor

@Sidnioulz Sidnioulz commented Mar 17, 2026

Fixes an inconsistency we spotted during QA.

Manual testing

Open SB, tab to zoom button, press Shift+ArrowUp and see it zooms by increments of 10% instead of 1%.

Summary by CodeRabbit

  • Improvements
    • Zoom preview: Arrow keys now adjust zoom in finer increments; holding Shift applies larger jumps for faster scaling.
    • Numeric inputs: Keyboard adjustments use a configurable step and support a Shift-multiplied (larger) step for quicker value changes.

@Sidnioulz Sidnioulz requested a review from ghengeveld March 17, 2026 16:17
@Sidnioulz Sidnioulz added bug ci:normal Run our default set of CI jobs (choose this for most PRs). upgrade:10.3 Issues/PRs found during 10.3 upgrade QA and post-release regressions labels Mar 17, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 17, 2026

View your CI Pipeline Execution ↗ for commit 96340a8

Command Status Duration Result
nx run-many -t compile -c production --parallel=1 ✅ Succeeded 5m 32s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-18 10:21:23 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 16afc468-994f-465e-99fc-2b38888855ef

📥 Commits

Reviewing files that changed from the base of the PR and between 35cf0aa and 2d48af8.

📒 Files selected for processing (2)
  • code/core/src/manager/components/preview/NumericInput.tsx
  • code/core/src/manager/components/preview/tools/zoom.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • code/core/src/manager/components/preview/NumericInput.tsx
  • code/core/src/manager/components/preview/tools/zoom.tsx

📝 Walkthrough

Walkthrough

Adds a public step prop (default 1) to NumericInput and changes ArrowUp/ArrowDown handling so numeric delta uses step with a Shift multiplier (×10). Adjusts ZoomButton ArrowUp/ArrowDown to pass larger deltas when Shift is pressed (±0.1 vs ±0.01).

Changes

Cohort / File(s) Summary
Numeric input: step & arrow-key delta
code/core/src/manager/components/preview/NumericInput.tsx
Added public prop step?: number with default step = 1; ArrowUp/ArrowDown compute delta = step and multiply by 10 when Shift is held; effect dependency array updated to include step.
Zoom keyboard handling
code/core/src/manager/components/preview/tools/zoom.tsx
Modified ZoomButton onKeyDown ArrowUp/ArrowDown to call zoomBy with Shift-aware deltas: ±0.1 when Shift pressed, otherwise ±0.01.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

Copy link
Copy Markdown
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also make the zoom input have that behavior, for consistency sake?

Image

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@code/core/src/manager/components/preview/NumericInput.tsx`:
- Around line 77-80: NumericInput currently destructures step and shiftStep
(preventing the native HTML step attribute from being forwarded by ...props) and
thus silently blocks the DOM attribute; rename these props to keyboardStep and
keyboardShiftStep throughout the component (update the prop type/interface and
the destructuring in the NumericInput function), use
keyboardStep/keyboardShiftStep for any internal arrow-key logic, and ensure the
original ...props still forwards native HTML attributes (so Form.Input receives
the real step attribute) — update all references to step and shiftStep inside
NumericInput to the new names to avoid shadowing the native attribute.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf377930-5cbb-46d7-9467-fb7aa9aef1bf

📥 Commits

Reviewing files that changed from the base of the PR and between dba2e28 and 35cf0aa.

📒 Files selected for processing (2)
  • code/core/src/manager/components/preview/NumericInput.tsx
  • code/core/src/manager/components/preview/tools/zoom.tsx

Comment on lines +77 to +80
/** Base step value increase */
step?: number;
/** Step value increase when shift key is pressed */
shiftStep?: number;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== NumericInput definition ==="
sed -n '69,205p' code/core/src/manager/components/preview/NumericInput.tsx

echo
echo "=== In-repo NumericInput call sites using step/shiftStep ==="
rg -n -U -P '<NumericInput\b(?:(?!/?>).|\n)*\b(step|shiftStep)\s*=' --glob '*.{ts,tsx,js,jsx}' code

echo
echo "=== Candidates for Form.Input prop typing / native input passthrough ==="
rg -n -C4 'Form\.Input|interface .*InputProps|type .*InputProps|<input\b|step\??:|suffix\??:' --glob '*.{ts,tsx}' code

Repository: storybookjs/storybook

Length of output: 4027


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the Form component
echo "=== Locating Form component ==="
fd -e ts -e tsx 'Form' code --type f | grep -i form | head -20

echo
echo "=== Searching for Form.Input definition or Form component interface ==="
rg -n 'export.*Form|interface Form|const Form|type Form|Form\.Input' code --glob '*.{ts,tsx}' | head -40

echo
echo "=== Looking for form-related component files ==="
fd -type f -name '*form*' code --glob '*.{ts,tsx}' | head -20

Repository: storybookjs/storybook

Length of output: 3670


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Form.tsx content ==="
cat -n code/core/src/components/components/Form/Form.tsx

echo
echo "=== Check for Input component import/definition in Form ==="
head -50 code/core/src/components/components/Form/Form.tsx

Repository: storybookjs/storybook

Length of output: 1329


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Input.tsx content ==="
cat -n code/core/src/components/components/Form/Input.tsx

Repository: storybookjs/storybook

Length of output: 2566


Rename step and shiftStep to avoid shadowing the native HTML step attribute.

Form.Input inherits step from HTMLProps<HTMLInputElement> (not explicitly omitted in its type definition), so it forwards the native HTML step attribute to the underlying input. However, NumericInput now destructures step locally and never forwards it via ...props, which silently prevents the native attribute from reaching the DOM element.

To avoid this semantic ambiguity, rename to keyboardStep and keyboardShiftStep to make it clear these control arrow-key behavior, not native HTML input stepping.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/core/src/manager/components/preview/NumericInput.tsx` around lines 77 -
80, NumericInput currently destructures step and shiftStep (preventing the
native HTML step attribute from being forwarded by ...props) and thus silently
blocks the DOM attribute; rename these props to keyboardStep and
keyboardShiftStep throughout the component (update the prop type/interface and
the destructuring in the NumericInput function), use
keyboardStep/keyboardShiftStep for any internal arrow-key logic, and ensure the
original ...props still forwards native HTML attributes (so Form.Input receives
the real step attribute) — update all references to step and shiftStep inside
NumericInput to the new names to avoid shadowing the native attribute.

@Sidnioulz Sidnioulz requested a review from yannbf March 18, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal Run our default set of CI jobs (choose this for most PRs). upgrade:10.3 Issues/PRs found during 10.3 upgrade QA and post-release regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants