Skip to content

[Bugfix:Forum] Fix TAB and ESC in forum textarea#12549

Merged
bmcutler merged 9 commits into
Submitty:mainfrom
akshitaa011:bugfix/forum-tab-esc
Apr 10, 2026
Merged

[Bugfix:Forum] Fix TAB and ESC in forum textarea#12549
bmcutler merged 9 commits into
Submitty:mainfrom
akshitaa011:bugfix/forum-tab-esc

Conversation

@akshitaa011

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Fixes #11801

The forum textarea had an accessibility message saying "Press TAB to indent. Press ESC to advance from answer area." However, TAB was not inserting a tab character and ESC was not working properly.

What is the New Behavior?

  • TAB now correctly inserts a tab character using setRangeText() which preserves the browser's Undo/Redo (Ctrl+Z) history
  • ESC now correctly moves focus to the next control element
  • enableTabsInTextArea is now initialized for all forum reply boxes

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Go to Discussion Forum
  2. Open any thread
  3. Click in the reply text area
  4. Press TAB — should insert tab character
  5. Press ESC — should move focus to next element

Automated Testing & Documentation

A Cypress test should be added in a follow-up issue.

Other information

No breaking changes.

@github-project-automation github-project-automation Bot moved this to Seeking Reviewer in Submitty Development Mar 7, 2026
@dagemcn
dagemcn self-requested a review March 10, 2026 20:34
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Mar 10, 2026

@dagemcn dagemcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a functionality and code review for this PR and everything looks good. I was able to observe the original behavior on main and the updated behavior after the fix. Code looks good as well.

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

codecov Bot commented Mar 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.64%. Comparing base (d7b82e3) to head (28353e2).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12549   +/-   ##
=========================================
  Coverage     21.64%   21.64%           
  Complexity     9654     9654           
=========================================
  Files           268      268           
  Lines         36244    36244           
  Branches        487      487           
=========================================
  Hits           7845     7845           
  Misses        27916    27916           
  Partials        483      483           
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.66% <ø> (ø)
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.

@akshitaa011

Copy link
Copy Markdown
Contributor Author

Thank you so much @dagemcn for the thorough review! I really
appreciate your time and feedback.

Also, could a maintainer please approve the workflows so the
CI checks can run? Thank you!

@dagemcn

dagemcn commented Mar 13, 2026

Copy link
Copy Markdown
Member

Thank you so much @dagemcn for the thorough review! I really appreciate your time and feedback.

Also, could a maintainer please approve the workflows so the CI checks can run? Thank you!

I have approved the workflows. CI tests should be done shortly.

@akshitaa011

Copy link
Copy Markdown
Contributor Author

The Cypress (UI) failures appear in sidebar.spec.js and student_info_panel.spec.js, both due to page load timeouts. Since the other Cypress tests passed and these failures occur during page loading, they may be unrelated to the TAB/ESC forum fix in this PR.
Could a maintainer please re-run the workflow or confirm if this might be a flaky CI issue? Thank you!

@Christian2147 Christian2147 self-assigned this Mar 13, 2026

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

So, the TAB and ESC characters do properly work when a user FIRST opens the discussion form and tries to type a reply on a thread.

However, from my tests, if the user, while on that same page, decided to click on another thread and type a reply, the functionality of both keys breaks again.

The behavior should be consistent regardless or how the user accesses a thread.

@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Work in Progress in Submitty Development Mar 18, 2026
@dagemcn

dagemcn commented Mar 19, 2026

Copy link
Copy Markdown
Member

The Cypress (UI) failures appear in sidebar.spec.js and student_info_panel.spec.js, both due to page load timeouts. Since the other Cypress tests passed and these failures occur during page loading, they may be unrelated to the TAB/ESC forum fix in this PR. Could a maintainer please re-run the workflow or confirm if this might be a flaky CI issue? Thank you!

I have approved the workflows to run. The tests will likely run successfully now that main has been merged into this branch.

@akshitaa011

Copy link
Copy Markdown
Contributor Author

Hi @Christian2147, I’ve pushed an update to PR #12549 addressing your feedback.

The TAB and ESC key handling is now implemented using event delegation, ensuring consistent behavior for dynamically loaded reply boxes when switching between threads without a page reload.

Please let me know if anything else should be adjusted.

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

I just retested this and it seems to be working properly this time, however, your CI tests are failing. Please work on fixing them.

@akshitaa011

Copy link
Copy Markdown
Contributor Author

Hi @Christian2147! I've pushed fixes for the CI failures — resolved the eslint errors in forum.js and server.js. Please let me know if anything else needs to be addressed!

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

I tested functionality again and everything looks to be working properly.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Apr 7, 2026
@bmcutler
bmcutler merged commit 68c6187 into Submitty:main Apr 10, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Apr 10, 2026
GarvitKhandelwal31 pushed a commit to GarvitKhandelwal31/Submitty that referenced this pull request Apr 13, 2026
### Why is this Change Important & Necessary?
Fixes Submitty#11801

The forum textarea had an accessibility message saying "Press TAB to
indent. Press ESC to advance from answer area." However, TAB was not
inserting a tab character and ESC was not working properly.

### What is the New Behavior?
- TAB now correctly inserts a tab character using `setRangeText()` which
preserves the browser's Undo/Redo (Ctrl+Z) history
- ESC now correctly moves focus to the next control element
- `enableTabsInTextArea` is now initialized for all forum reply boxes

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. Go to Discussion Forum
2. Open any thread
3. Click in the reply text area
4. Press TAB — should insert tab character
5. Press ESC — should move focus to next element

### Automated Testing & Documentation
A Cypress test should be added in a follow-up issue.

### Other information
No breaking changes.
@akshitaa011

Copy link
Copy Markdown
Contributor Author

Thank you @Christian2147, @dagemcn and @bmcutler for the reviews and merging! Really appreciate the feedback and patience throughout this process.

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.

Forum does not support TAB or ESC functionality

4 participants