Skip to content

fix(field-slider): sync the slider when the text editor changes after a drag - #10667

Open
shkomg wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
userstoriesbot-showcase:fix/field-slider-sync-after-drag
Open

shkomg wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
userstoriesbot-showcase:fix/field-slider-sync-after-drag

Conversation

@shkomg

@shkomg shkomg commented Nov 7, 2026

Copy link
Copy Markdown

The basics

The details

Resolves

Fixes #10330

Proposed Changes

updateSlider_() in field_slider.ts now sets the range input’s value property instead of its value attribute. One line, plus a comment.

Reason for Changes

After you drag the slider knob once, it stops following the inline text editor. That’s because browsers only read the value attribute as the initial value; once the user has interacted with a range input, changing the attribute does nothing, but setting the property moves the knob. Happens in v11 and v12.

Test Coverage

Added a unit test, “Slider follows the text editor after being dragged”: open the editor, drag to 20, type 70 in the text field, check the slider shows 70. Runs under jsdom with small stubs for SVGElement, FocusEvent and requestAnimationFrame.

Video of the fixed playground: https://github.com/user-attachments/assets/d7fbcf5d-3891-43a0-80ab-0b57a437329d

Documentation

None, no API change.

Additional Information

AI use: The fix and the test were written with Claude Code. The video is an automated run of this branch recorded by User Stories Bot. I reviewed the diff and wrote this description.

… a drag

updateSlider_() set the range input's value attribute, which browsers
ignore once the user has moved the slider. Set the value property
instead so the knob follows values typed into the text editor.
@shkomg
shkomg requested a review from a team as a code owner November 7, 2026 23:13
@shkomg
shkomg requested a review from lizschwab November 7, 2026 23:13
@github-actions github-actions Bot added the PR: fix Fixes a bug label Nov 7, 2026

@github-actions github-actions Bot left a comment

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.

Welcome! It looks like this is your first pull request in Blockly, so here are a couple of tips:

  • You can find tips about contributing to Blockly and how to validate your changes on our developer site.
  • We use conventional commits to make versioning the package easier. Make sure your commit message is in the proper format or learn how to fix it.
  • If any of the other checks on this PR fail, you can click on them to learn why. It might be that your change caused a test failure, or that you need to double-check the style guide.
    Thank you for opening this PR! A member of the Blockly team will review it soon.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider fields doesn't auto-update when changing the inline editor after sliding the slider knob

2 participants