Skip to content

[Bugfix:InstructorUI] Fix missing cursor in config editor#12554

Merged
williamjallen merged 2 commits into
Submitty:mainfrom
Aditya060806:fix/config-editor-cursor-visibility
Mar 23, 2026
Merged

[Bugfix:InstructorUI] Fix missing cursor in config editor#12554
williamjallen merged 2 commits into
Submitty:mainfrom
Aditya060806:fix/config-editor-cursor-visibility

Conversation

@Aditya060806

Copy link
Copy Markdown
Contributor

Description

Fixes the missing blinking cursor in the autograding configuration editor on the Edit Gradeable > Submission/Autograding tab.

When a file (e.g., \config.json) is clicked in the file tree to open it in the CodeMirror editor, no cursor is visible. The user can type and edit, but there is no visual indicator of the cursor position, making editing difficult and confusing.

Root Cause

The CodeMirror instance is created inside a container (#gradeable-config-structure) that starts with \display: none\ and is toggled open dynamically. When \CodeMirror.fromTextArea()\ runs:

  1. The editor does not automatically receive focus, so no blinking cursor is shown.
  2. The editor may miscalculate its layout because it was initialized in a previously-hidden container.

Fix

Added two calls after CodeMirror initialization in \loadCodeMirror():

  • *\codeMirrorInstance.refresh()* — Forces CodeMirror to recalculate its layout so the cursor renders at the correct position.
  • *\codeMirrorInstance.focus()* — Gives the editor focus and places a blinking cursor at the beginning of the document.

Since
eloadCodeMirror()\ (used by toggle line numbers / tab size settings) calls \loadCodeMirror()\ internally, the fix applies to both initial file loading and editor setting changes.

Testing

  1. Go to any Edit Gradeable page
  2. Click the Submission/Autograding tab
  3. Select an uploaded autograding configuration
  4. Click Open Editor
  5. Click on \config.json\ (or any file) in the file tree
  6. ✅ A blinking cursor appears at the beginning of the document
  7. Click within the text → cursor moves to clicked position
  8. Toggle line numbers / tab size → cursor remains visible after reload
  9. Switch between files → cursor appears for each newly loaded file

Closes #12551

… tab

When the CodeMirror editor is initialized for the autograding config editor, the cursor is not visible because the editor is not focused after creation. This is especially problematic since the editor lives inside a dynamically toggled container that starts hidden.

Add refresh() to recalculate layout after the editor is rendered in the previously-hidden container, and focus() to place the blinking cursor at the beginning of the document.

Fixes: cursor not visible when clicking to edit config.json in the Edit Gradeable > Submission/Autograding tab.
@shreyashrpawar

shreyashrpawar commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

I’ve tested these changes locally, but unfortunately, I'm still seeing the original issue on my system. @Aditya060806, could you double-check if it solves the issue?

@shreyashrpawar

Copy link
Copy Markdown
Contributor

@williamjallen I looked at both PRs, but I think #12554 is actually tackling the wrong problem. That approach would work if the issue were the editor's size/geometry, but the bug is just a color contrast issue. The cursor is actually there; it's just invisible because it's inheriting a color that matches the background.

My PR #12552 fixes this directly by setting the color. It's a much simpler fix and avoids changing the editor's logic when we only need a style change.

@roye2
roye2 self-requested a review March 20, 2026 21:50
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Mar 20, 2026

@roye2 roye2 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.

The changes to the code are simple and refreshing the cursor through codemirror is the correct approach. I tested the changes in the editor on my VM in Light and Dark mode and they work as intended.

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Mar 20, 2026
@codecov

codecov Bot commented Mar 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.66%. Comparing base (9cb25d6) to head (3063117).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12554   +/-   ##
=========================================
  Coverage     21.66%   21.66%           
  Complexity     9637     9637           
=========================================
  Files           268      268           
  Lines         36222    36222           
  Branches        487      487           
=========================================
  Hits           7847     7847           
  Misses        27892    27892           
  Partials        483      483           
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.68% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@williamjallen
williamjallen merged commit 8497aa3 into Submitty:main Mar 23, 2026
47 of 48 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Mar 23, 2026
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Mar 25, 2026
…2554)

## Description

Fixes the missing blinking cursor in the autograding configuration
editor on the Edit Gradeable > Submission/Autograding tab.

When a file (e.g., \config.json\) is clicked in the file tree to open it
in the CodeMirror editor, no cursor is visible. The user can type and
edit, but there is no visual indicator of the cursor position, making
editing difficult and confusing.

### Root Cause

The CodeMirror instance is created inside a container
(\#gradeable-config-structure\) that starts with \display: none\ and is
toggled open dynamically. When \CodeMirror.fromTextArea()\ runs:

1. The editor does not automatically receive focus, so no blinking
cursor is shown.
2. The editor may miscalculate its layout because it was initialized in
a previously-hidden container.

### Fix

Added two calls after CodeMirror initialization in \loadCodeMirror()\:

- **\codeMirrorInstance.refresh()\** — Forces CodeMirror to recalculate
its layout so the cursor renders at the correct position.
- **\codeMirrorInstance.focus()\** — Gives the editor focus and places a
blinking cursor at the beginning of the document.

Since \ eloadCodeMirror()\ (used by toggle line numbers / tab size
settings) calls \loadCodeMirror()\ internally, the fix applies to both
initial file loading and editor setting changes.

### Testing

1. Go to any Edit Gradeable page
2. Click the **Submission/Autograding** tab
3. Select an uploaded autograding configuration
4. Click **Open Editor**
5. Click on \config.json\ (or any file) in the file tree
6. ✅ A blinking cursor appears at the beginning of the document
7. Click within the text → cursor moves to clicked position
8. Toggle line numbers / tab size → cursor remains visible after reload
9. Switch between files → cursor appears for each newly loaded file

Closes Submitty#12551

Co-authored-by: Emma Roy <[email protected]>
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Mar 29, 2026
…2554)

## Description

Fixes the missing blinking cursor in the autograding configuration
editor on the Edit Gradeable > Submission/Autograding tab.

When a file (e.g., \config.json\) is clicked in the file tree to open it
in the CodeMirror editor, no cursor is visible. The user can type and
edit, but there is no visual indicator of the cursor position, making
editing difficult and confusing.

### Root Cause

The CodeMirror instance is created inside a container
(\#gradeable-config-structure\) that starts with \display: none\ and is
toggled open dynamically. When \CodeMirror.fromTextArea()\ runs:

1. The editor does not automatically receive focus, so no blinking
cursor is shown.
2. The editor may miscalculate its layout because it was initialized in
a previously-hidden container.

### Fix

Added two calls after CodeMirror initialization in \loadCodeMirror()\:

- **\codeMirrorInstance.refresh()\** — Forces CodeMirror to recalculate
its layout so the cursor renders at the correct position.
- **\codeMirrorInstance.focus()\** — Gives the editor focus and places a
blinking cursor at the beginning of the document.

Since \ eloadCodeMirror()\ (used by toggle line numbers / tab size
settings) calls \loadCodeMirror()\ internally, the fix applies to both
initial file loading and editor setting changes.

### Testing

1. Go to any Edit Gradeable page
2. Click the **Submission/Autograding** tab
3. Select an uploaded autograding configuration
4. Click **Open Editor**
5. Click on \config.json\ (or any file) in the file tree
6. ✅ A blinking cursor appears at the beginning of the document
7. Click within the text → cursor moves to clicked position
8. Toggle line numbers / tab size → cursor remains visible after reload
9. Switch between files → cursor appears for each newly loaded file

Closes Submitty#12551

Co-authored-by: Emma Roy <[email protected]>
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Apr 14, 2026
…2554)

## Description

Fixes the missing blinking cursor in the autograding configuration
editor on the Edit Gradeable > Submission/Autograding tab.

When a file (e.g., \config.json\) is clicked in the file tree to open it
in the CodeMirror editor, no cursor is visible. The user can type and
edit, but there is no visual indicator of the cursor position, making
editing difficult and confusing.

### Root Cause

The CodeMirror instance is created inside a container
(\#gradeable-config-structure\) that starts with \display: none\ and is
toggled open dynamically. When \CodeMirror.fromTextArea()\ runs:

1. The editor does not automatically receive focus, so no blinking
cursor is shown.
2. The editor may miscalculate its layout because it was initialized in
a previously-hidden container.

### Fix

Added two calls after CodeMirror initialization in \loadCodeMirror()\:

- **\codeMirrorInstance.refresh()\** — Forces CodeMirror to recalculate
its layout so the cursor renders at the correct position.
- **\codeMirrorInstance.focus()\** — Gives the editor focus and places a
blinking cursor at the beginning of the document.

Since \ eloadCodeMirror()\ (used by toggle line numbers / tab size
settings) calls \loadCodeMirror()\ internally, the fix applies to both
initial file loading and editor setting changes.

### Testing

1. Go to any Edit Gradeable page
2. Click the **Submission/Autograding** tab
3. Select an uploaded autograding configuration
4. Click **Open Editor**
5. Click on \config.json\ (or any file) in the file tree
6. ✅ A blinking cursor appears at the beginning of the document
7. Click within the text → cursor moves to clicked position
8. Toggle line numbers / tab size → cursor remains visible after reload
9. Switch between files → cursor appears for each newly loaded file

Closes Submitty#12551

Co-authored-by: Emma Roy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug] Editing cursor not showing in Edit Uploaded Configuration

4 participants