Skip to content

Conversation

demvlad
Copy link
Contributor

@demvlad demvlad commented Jul 24, 2025

Show spin button into number input fields of users settings dialog
config_spin_button

Summary by CodeRabbit

Summary by CodeRabbit

  • Style
    • Improved visibility and appearance of spin buttons for number input fields in the user settings dialog, ensuring they display consistently across browsers.

@demvlad demvlad marked this pull request as draft July 24, 2025 18:21
Copy link

coderabbitai bot commented Jul 24, 2025

Walkthrough

The CSS for the user settings dialog was updated to explicitly style the inner and outer spin buttons of number input fields. The changes enforce default browser appearance, full opacity, and automatic sizing to ensure the spin buttons are visible and rendered consistently across browsers.

Changes

File(s) Change Summary
src/css/user_settings_dialog.css Added CSS rules targeting ::-webkit-inner-spin-button and ::-webkit-outer-spin-button to enforce default appearance, full opacity, and automatic sizing for number input spin buttons.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6660ea and 8be24e5.

📒 Files selected for processing (1)
  • src/css/user_settings_dialog.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/css/user_settings_dialog.css
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@demvlad
Copy link
Contributor Author

demvlad commented Jul 24, 2025

@coderabbitai
Please check. Why the spin buttons do not show at users settings dialog input number fields?

Copy link

coderabbitai bot commented Jul 24, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

I'll help you investigate why the spin buttons aren't showing on number input fields in the user settings dialog. Let me examine the codebase to identify the issue.


🏁 Script executed:

#!/bin/bash
# First, let's find files related to user settings dialog
echo "=== Searching for user settings dialog files ==="
fd -t f -e html -e js -e css | xargs rg -l -i "settings.*dialog|dialog.*settings|user.*settings" | head -10

echo -e "\n=== Searching for number input fields ==="
rg -A 5 -B 5 'type="number"' --type html --type js

echo -e "\n=== Searching for spin button related CSS ==="  
rg -A 3 -B 3 'spin.*button|webkit.*spin|moz.*spin' --type css

Length of output: 19631


Now let me examine the user settings dialog files more closely to understand the specific issue:

Based on my investigation, I've found the root cause of the missing spin buttons in the user settings dialog. Here's what's happening:

Problem Analysis

The issue is caused by a global CSS rule in src/css/header_dialog.css that hides the spin buttons:

input[type="number"]::-webkit-inner-spin-button {
  opacity: 0; /* 1 is required for chromium 33+ beta to show the arrows / spinners */
}

This rule applies globally to all number inputs in the application, making the spin buttons invisible.

Current Workarounds in Other Dialogs

I noticed that other parts of the application explicitly override this global rule to show spin buttons where needed. For example, in src/css/main.css:

.analyser input#analyserMinPSD::-webkit-inner-spin-button,
.analyser input#analyserMinPSD::-webkit-outer-spin-button,
.analyser input#analyserMaxPSD::-webkit-inner-spin-button,
.analyser input#analyserMaxPSD::-webkit-outer-spin-button,
.analyser input#analyserLowLevelPSD::-webkit-inner-spin-button,
.analyser input#analyserLowLevelPSD::-webkit-outer-spin-button {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
}

Solution

To fix the spin buttons in the user settings dialog, you need to add similar CSS rules to src/css/user_settings_dialog.css. Here's the fix:

.user-settings-dialog input[type="number"]::-webkit-inner-spin-button,
.user-settings-dialog input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  opacity: 1 !important;
}

This will:

  1. Override the global opacity: 0 rule
  2. Ensure the spin buttons have the default browser appearance
  3. Make them visible and functional in the user settings dialog

The current user_settings_dialog.css only has spin button rules for checkboxes, but not for number inputs, which is why the issue exists specifically in that dialog.

@demvlad Would you like me to create a plan to implement this fix?


🏁 Script executed:

#!/bin/bash
# Let's examine the user settings dialog HTML structure and CSS
echo "=== Examining user_settings_dialog.js ==="
cat src/user_settings_dialog.js | head -50

echo -e "\n=== Looking for user settings dialog HTML in index.html ==="
rg -A 20 -B 5 'user.*settings.*dialog|dialog.*user.*settings' index.html

echo -e "\n=== Examining user_settings_dialog.css ==="
cat src/css/user_settings_dialog.css

Length of output: 9413


🏁 Script executed:

#!/bin/bash
# Let's look at the general CSS rules that might be affecting number inputs globally
echo "=== Checking global input styling ==="
rg -A 5 -B 5 'input\[type="number"\]' --type css

echo -e "\n=== Looking for any webkit-appearance or appearance rules ==="
rg -A 3 -B 3 'webkit-appearance|appearance.*none|appearance.*auto' --type css

Length of output: 4585


Perfect! Now I have a complete understanding of the issue. Let me provide you with the exact solution:

Root Cause Confirmed

The issue is indeed caused by the global CSS rule in src/css/header_dialog.css:

input[type="number"]::-webkit-inner-spin-button {
  opacity: 0; /* 1 is required for chromium 33+ beta to show the arrows / spinners */
}

This rule hides all spin buttons globally across the entire application.

Current Solution Pattern

I can see that the application already uses a pattern to selectively show spin buttons where needed. For example, in src/css/main.css, specific analyzer inputs have their spin buttons re-enabled:

.analyser input#analyserMinPSD::-webkit-inner-spin-button,
.analyser input#analyserMinPSD::-webkit-outer-spin-button,
.analyser input#analyserMaxPSD::-webkit-inner-spin-button,
.analyser input#analyserMaxPSD::-webkit-outer-spin-button,
.analyser input#analyserLowLevelPSD::-webkit-inner-spin-button,
.analyser input#analyserLowLevelPSD::-webkit-outer-spin-button {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  opacity: 1 !important;
  height: auto !important;
  width: auto !important;
}

The Missing Piece

The src/css/user_settings_dialog.css file has spin button rules, but only for checkboxes, not for number inputs:

.user-settings-dialog input[type="checkbox"]::-webkit-inner-spin-button,
.user-settings-dialog input[type="checkbox"]::-webkit-outer-spin-button

Solution

Add this CSS rule to src/css/user_settings_dialog.css to fix the spin buttons for number inputs in the user settings dialog:

.user-settings-dialog input[type="number"]::-webkit-inner-spin-button,
.user-settings-dialog input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  opacity: 1 !important;
  height: auto !important;
  width: auto !important;
}

This follows the exact same pattern already established in the codebase and will restore the spin buttons for all number input fields in the user settings dialog.

@demvlad The fix is straightforward - just add the CSS rule above to the src/css/user_settings_dialog.css file. This will make the spin buttons visible and functional in the user settings dialog while maintaining the current behavior in other parts of the application.


🧠 Learnings used
Learnt from: nerdCopter
PR: betaflight/blackbox-log-viewer#822
File: .github/workflows/deploy-preview.yml:17-19
Timestamp: 2025-05-14T16:08:27.254Z
Learning: For betaflight/blackbox-log-viewer repository, the team is aware of the security implications of using `pull_request_target` without specifying `persist-credentials: false` in the checkout action, and has chosen to proceed with the current approach. This concern should not be flagged in future reviews.

Learnt from: demvlad
PR: betaflight/blackbox-log-viewer#0
File: :0-0
Timestamp: 2025-06-29T18:40:50.980Z
Learning: In betaflight/blackbox-log-viewer, when implementing PSD heatmap settings persistence in src/graph_spectrum.js, the initialization sequence is critical - user settings must be initialized and applied to GraphSpectrumPlot before attaching input event handlers to prevent spurious refresh() calls that can cause spectrum rendering errors when disabled.

@demvlad
Copy link
Contributor Author

demvlad commented Jul 24, 2025

@coderabbitai
Thank's. Yes, i had a mistake. The all are working now

@demvlad demvlad marked this pull request as ready for review July 24, 2025 18:28
Copy link

coderabbitai bot commented Jul 24, 2025

Tip

For best results, initiate chat on the files or code changes.

@demvlad Great to hear that the spin buttons are working now! I'm glad the CSS fix resolved the issue for you. Thanks for confirming that everything is functioning properly in the user settings dialog.

    (\   /)
   ( ._. )
  o_(")(")
  Happy rabbit!

🧠 Learnings used
Learnt from: nerdCopter
PR: betaflight/blackbox-log-viewer#822
File: .github/workflows/deploy-preview.yml:17-19
Timestamp: 2025-05-14T16:08:27.254Z
Learning: For betaflight/blackbox-log-viewer repository, the team is aware of the security implications of using `pull_request_target` without specifying `persist-credentials: false` in the checkout action, and has chosen to proceed with the current approach. This concern should not be flagged in future reviews.

Learnt from: demvlad
PR: betaflight/blackbox-log-viewer#0
File: :0-0
Timestamp: 2025-06-29T18:40:50.980Z
Learning: In betaflight/blackbox-log-viewer, when implementing PSD heatmap settings persistence in src/graph_spectrum.js, the initialization sequence is critical - user settings must be initialized and applied to GraphSpectrumPlot before attaching input event handlers to prevent spurious refresh() calls that can cause spectrum rendering errors when disabled.

Copy link

@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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1482e2d and e6660ea.

📒 Files selected for processing (1)
  • src/css/user_settings_dialog.css (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: nerdCopter
PR: betaflight/blackbox-log-viewer#822
File: .github/workflows/deploy-preview.yml:17-19
Timestamp: 2025-05-14T16:08:27.254Z
Learning: For betaflight/blackbox-log-viewer repository, the team is aware of the security implications of using `pull_request_target` without specifying `persist-credentials: false` in the checkout action, and has chosen to proceed with the current approach. This concern should not be flagged in future reviews.
Learnt from: demvlad
PR: betaflight/blackbox-log-viewer#0
File: :0-0
Timestamp: 2025-06-29T18:40:50.980Z
Learning: In betaflight/blackbox-log-viewer, when implementing PSD heatmap settings persistence in src/graph_spectrum.js, the initialization sequence is critical - user settings must be initialized and applied to GraphSpectrumPlot before attaching input event handlers to prevent spurious refresh() calls that can cause spectrum rendering errors when disabled.

Copy link

Preview URL: https://8be24e5d.betaflight-blackbox.pages.dev

Copy link

@demvlad
Copy link
Contributor Author

demvlad commented Jul 24, 2025

@haslinghuis
Seems the spin buttons are showed in BF Configurator without this CSS code. This is interested.

@demvlad demvlad changed the title Added spin button into number input fields of users settings dialog Show spin button into number input fields of users settings dialog Jul 24, 2025
@demvlad demvlad changed the title Show spin button into number input fields of users settings dialog Show spin buttons into number input fields of users settings dialog Jul 24, 2025
@haslinghuis haslinghuis merged commit 7fc3e2c into betaflight:master Jul 25, 2025
5 checks passed
@demvlad demvlad deleted the numeric_updown branch September 17, 2025 13:47
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 this pull request may close these issues.

3 participants