Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Oct 3, 2025

Summary by CodeRabbit

  • New Features

    • CLI dialog now auto-focuses the command input shortly after opening for quicker typing when visible.
  • Bug Fixes

    • Close button text now correctly uses the localized “close” label.
    • Reset action now clears the CLI response area instead of erasing the typed command, preventing accidental loss of input.

@haslinghuis haslinghuis added this to the 2025.12 milestone Oct 3, 2025
@haslinghuis haslinghuis self-assigned this Oct 3, 2025
@haslinghuis haslinghuis moved this to App in 2025.12.0 Oct 3, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Updated CLI dialog behavior in src/js/gui.js: the close button now uses the close i18n key, the reset action clears the CLI response area (not the command input), and opening the dialog schedules a delayed focus on the CLI input when visible.

Changes

Cohort / File(s) Summary of changes
CLI dialog UX adjustments
src/js/gui.js
- Use i18n key close for buttonCloseText
- Reset now clears CLI response area instead of the command input
- On dialog open, setTimeout focuses CLI input if visible

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant G as GUI
  participant D as CLI_Dialog
  participant I18N as i18n
  participant IN as CLI_Input
  participant R as CLI_Response

  U->>G: Open CLI dialog
  G->>D: open()
  G->>I18N: get("close")
  I18N-->>G: localized "close"
  G->>D: set buttonCloseText

  note over G,D: After dialog open
  G->>G: setTimeout(...)
  G->>IN: focus() if visible

  U->>G: Reset CLI
  G->>R: clear()
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request has no description and does not include any of the required sections from the repository’s template, so it fails to document the purpose, context, and testing instructions for the changes. Please add a detailed pull request description following the provided template, including a concise summary of changes, motivation, testing steps, CI results, coding style compliance, and any related issue references.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly highlights the two primary changes—adding focus behavior to the CLI panel and correcting the internationalization key—accurately reflecting the main updates without irrelevant details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff421cf and 6b844a7.

📒 Files selected for processing (1)
  • src/js/gui.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/js/gui.js (1)
src/js/localization.js (1)
  • i18n (7-7)
🔇 Additional comments (3)
src/js/gui.js (3)

454-454: LGTM! Proper i18n implementation.

The close button text now uses the i18n translation key, ensuring proper internationalization support.


457-458: Good fix! Clears stale CLI output correctly.

The change from clearing the command input to clearing the response area is correct. The command input is already cleared after each command execution (line 436), so clearing the response area prevents users from seeing stale CLI output from previous sessions.


462-469: LGTM! Focus management improves UX.

The focus management implementation is good. The timeout ensures the dialog is rendered, and the visibility check prevents errors. Users can now immediately start typing CLI commands when the panel opens.


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

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

Copy link
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: 0

🧹 Nitpick comments (1)
src/js/gui.js (1)

462-469: Good UX improvement with proper safeguards.

The delayed focus implementation correctly handles the timing issue with dialog rendering. The visibility and existence checks prevent potential errors, and the 100ms timeout is a reasonable delay.

Consider whether the dialog system exposes an open or shown event that could be used instead of setTimeout. This would be more robust than a fixed delay:

dialog[0].addEventListener('open', () => {
    const cliInput = $("#cli-command");
    if (cliInput.length > 0 && cliInput.is(":visible")) {
        cliInput.focus();
    }
});

However, if the dialog doesn't expose such events, the current timeout approach is acceptable.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4755613 and ff421cf.

📒 Files selected for processing (1)
  • src/js/gui.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/js/gui.js (1)
src/js/localization.js (1)
  • i18n (7-7)
🔇 Additional comments (2)
src/js/gui.js (2)

454-454: LGTM! Proper i18n implementation.

The change correctly makes the close button text translatable by using the i18n.getMessage("close") key instead of a hardcoded string, which aligns with the i18n pattern used elsewhere in the codebase.


457-458: Clearing response area prevents stale data from previous sessions.

The change to clear the CLI response area instead of the command input makes sense, as it prevents old responses from appearing when reopening the CLI dialog. The command input is already cleared after each command execution (line 436).

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2025

@haslinghuis haslinghuis requested a review from blckmn October 3, 2025 17:06
@haslinghuis haslinghuis merged commit 34036b9 into betaflight:master Oct 3, 2025
8 checks passed
@haslinghuis haslinghuis deleted the fix-cli-panel branch October 3, 2025 19:17
@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants