Skip to content

Implement F1 help toggle with conditional ESC behavior#31

Merged
RuntimeRascal merged 8 commits intomainfrom
copilot/rework-f1-help-closing-behavior
Dec 11, 2025
Merged

Implement F1 help toggle with conditional ESC behavior#31
RuntimeRascal merged 8 commits intomainfrom
copilot/rework-f1-help-closing-behavior

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 11, 2025

The help overlay auto-hid after 4 seconds and ESC always exited drawing mode, making it difficult to reference shortcuts while drawing.

Changes

Help Toggle Pattern

  • Removed auto-hide timer; F1 now toggles help on/off
  • Added _isHelpVisible state field synchronized with animations
  • Help remains visible until explicitly dismissed

Conditional ESC Handling

  • OverlayWindow.HandleEscapeKey() returns bool indicating whether to exit drawing mode
  • Returns false when help is visible (close help only)
  • Returns true when help is hidden (emergency exit)
  • DrawingManager.ForceDisableDrawing() respects this return value
public bool HandleEscapeKey()
{
    if (_isHelpVisible)
    {
        HideHelp();
        return false; // Stay in drawing mode
    }
    return true; // Exit drawing mode
}

UI Updates

  • F1: "Show This Help" → "Toggle This Help"
  • ESC: "Exit Draw Mode" → "Close Help / Exit Draw Mode"

Testing

  • Added HelpToggleFeatureTests.cs with coverage for toggle behavior and conditional ESC logic
Original prompt

This section details on the original issue you should resolve

<issue_title>Rework F1 Help Closing Behavior</issue_title>
<issue_description>## Feature Request: Rework F1 Help Closing Behavior

Current Behavior

  • Pressing F1 while in drawing mode opens the keyboard shortcuts help overlay.
  • The help overlay auto-hides after a short timeout.
  • ESC always exits drawing mode (emergency exit), regardless of whether the help overlay is open.

Problems

  • Users do not always have enough time to read/understand all shortcuts before the overlay disappears.
  • There is no simple way to keep the help overlay open for reference while drawing.
  • Hitting ESC when the help overlay is visible both closes help (visually) and exits drawing mode, which is surprising.

Desired Behavior

1. Help Overlay Toggle with F1

  • F1 should act as a toggle for the help overlay while in drawing mode:
    • If help is not visible: pressing F1 shows the help overlay.
    • If help is visible: pressing F1 hides the help overlay.
  • No auto-hide timeout when opened this way.

2. ESC Behavior When Help Is Open

  • When the help overlay is visible and user presses ESC:
    • Only close the help overlay.
    • Do NOT exit drawing mode in this case.
  • When the help overlay is not visible and user presses ESC:
    • Behavior should remain the same as today: exit drawing mode (emergency exit).

3. Drawing Mode Integrity

  • Showing or hiding the help overlay must never interfere with:
    • Global keyboard/mouse hooks
    • Overlay window visibility
    • Active drawing tool state (Pen/Line/Rectangle/Circle/Eraser)

Proposed Implementation

State & Logic

  • Introduce a dedicated boolean state (e.g., IsHelpVisible) in the view model or code-behind for OverlayWindow.
  • Replace/rework the existing auto-hide timer logic:
    • Timer-based auto-hide should be removed or only used when explicitly desired (e.g., future quick tips).
  • Update F1 handler (GlobalKeyboardHook.HelpPressed wiring in OverlayWindow.xaml.cs) to:
    • Toggle IsHelpVisible instead of always starting a timed show/hide sequence.

ESC Handling

  • In OverlayWindow.xaml.cs (or wherever ESC is handled):
    • If IsHelpVisible == true when ESC is pressed:
      • Set IsHelpVisible = false and return.
      • Do not deactivate drawing mode, do not hide overlay.
    • Else (help not visible):
      • Keep current behavior: exit drawing mode and hide overlay window.

UI Layer

  • Ensure the help overlay visibility is fully driven by IsHelpVisible:
    • Visibility bound to IsHelpVisible (or similar property) instead of timer-only logic.
    • Any animations (fade-in/out) should be triggered on property changes, not fixed timers.

Files Likely Involved

  • Src/GhostDraw/Views/OverlayWindow.xaml
    • Help overlay visual definition and bindings
  • Src/GhostDraw/Views/OverlayWindow.xaml.cs
    • F1 key handling (help toggle)
    • ESC handling (conditional behavior based on help visibility)
    • Existing timer/dispatcher logic for auto-hide
  • Src/GhostDraw/Core/GlobalKeyboardHook.cs
    • Confirm HelpPressed event wiring remains correct

Acceptance Criteria

  • Pressing F1 in drawing mode shows help overlay and it stays visible until user explicitly closes it.
  • Pressing F1 again while help is visible hides the help overlay (toggle behavior).
  • Pressing ESC while help is visible only closes help and does not exit drawing mode.
  • Pressing ESC when help is not visible exits drawing mode (current behavior preserved).
  • No auto-hide timeout for the main F1 help overlay.
  • Existing drawing tools (Pen, Line, Rectangle, Circle, Eraser) continue to work normally while help is visible.
  • No regressions in global hook behavior, overlay visibility, or emergency escape behavior.

Priority & Impact

  • Priority: Medium-High
  • Impact: Improves usability and discoverability of shortcuts, reduces accidental exits from drawing mode when using help.

Labels: enhancement, help-overlay, UX
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits December 11, 2025 00:25
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
…tion

Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
Copilot AI changed the title [WIP] Rework F1 help closing behavior to allow overlay toggle Implement F1 help toggle with conditional ESC behavior Dec 11, 2025
Copilot AI requested a review from RuntimeRascal December 11, 2025 00:39
@RuntimeRascal RuntimeRascal marked this pull request as ready for review December 11, 2025 01:19
@RuntimeRascal RuntimeRascal merged commit 97d9971 into main Dec 11, 2025
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.

Rework F1 Help Closing Behavior

2 participants