Skip to content

Conversation

@luarmr
Copy link
Contributor

@luarmr luarmr commented Jun 11, 2025

Currently hotkeys are not working properly for input number elements.

The origin of the problem is that the method falls back to 0 when max is not defined. But when working on it, I realized that the increaseValue method does not:

  • Respect minimum value (for example, when 0 is lower than the minimum value)
  • Work when maximum is not defined
  • Increase according to the step parameter
  • Use the default value as the initial value

As extreme scenario to consider. min=.1 max=.7 step=.1 defaultvalue=.5

A better fix would likely be to sanitize the value when the tag is created. However, since I couldn't identify the pattern and it appears that only this isolated method is affected, I decided not to overcomplicate the component.

tested on cases like:


<View>
  <!-- Test area for shortcuts -->
  <TextArea name="text1" toName="text" />
  <TextArea name="text2" toName="text" />
  
  <!-- Text content -->
  <Text name="text" value="$text" />
  
  <!-- Number variations -->
  <Header value="Basic number - no parameters" />
  <Number name="number_basic" toName="text" />
  
  <Header value="Number with min=5 - should not go below 5" />
  <Number name="number_min" toName="text" min="5" />
  
  <Header value="Number with max=10 - should not go above 10" />
  <Number name="number_max" toName="text" max="10" />
  
  <Header value="Number with step=2 - should increment by 2" />
  <Number name="number_step" toName="text" step="2" />
  
  <Header value="Number with defaultvalue=3 - should start at 3" />
  <Number name="number_default" toName="text" defaultvalue="3" />
  
  <Header value="Complete configuration - min=0, max=100, step=1, defaultvalue=2" />
  <Number name="number_complete" toName="text" min="0" max="100" step="1" defaultvalue="2" />
  
  <Header value="Number with hotkey='n' - press 'n' to increment" />
  <Number name="number_hotkey" toName="text" hotkey="n" />
  
  <Header value="Required number - must be filled" />
  <Number name="number_required" toName="text" required="true" />
  
  <Header value="Number with slider - visual slider control" />
  <Number name="number_slider" toName="text" slider="true" min="0" max="10" />
</View>

@hlomzik can you take a look to this?

@netlify
Copy link

netlify bot commented Jun 11, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 65d92e9
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/684a0c86c2678c000878b30e

@netlify
Copy link

netlify bot commented Jun 11, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 65d92e9
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/684a0c86b4bfb4000866ce89
😎 Deploy Preview https://deploy-preview-7746--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jun 11, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 65d92e9
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/684a0c86c0959d0008ced95b

@github-actions github-actions bot added the fix label Jun 11, 2025
@netlify
Copy link

netlify bot commented Jun 11, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 65d92e9
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/684a0c86954ded0008ec4339
😎 Deploy Preview https://deploy-preview-7746--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@robot-ci-heartex robot-ci-heartex merged commit 2efdea6 into develop Jun 12, 2025
47 checks passed
@robot-ci-heartex robot-ci-heartex deleted the fb-triag-1357/hotkey-not-working-for-number-tag branch June 12, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants