[Bugfix:Forum] Fix TAB and ESC in forum textarea#12549
Conversation
dagemcn
left a comment
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Thank you so much @dagemcn for the thorough review! I really Also, could a maintainer please approve the workflows so the |
I have approved the workflows. CI tests should be done shortly. |
|
The Cypress (UI) failures appear in |
Christian2147
left a comment
There was a problem hiding this comment.
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.
I have approved the workflows to run. The tests will likely run successfully now that main has been merged into this branch. |
|
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
left a comment
There was a problem hiding this comment.
I just retested this and it seems to be working properly this time, however, your CI tests are failing. Please work on fixing them.
|
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
left a comment
There was a problem hiding this comment.
I tested functionality again and everything looks to be working properly.
### 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.
|
Thank you @Christian2147, @dagemcn and @bmcutler for the reviews and merging! Really appreciate the feedback and patience throughout this process. |
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?
setRangeText()which preserves the browser's Undo/Redo (Ctrl+Z) historyenableTabsInTextAreais now initialized for all forum reply boxesWhat steps should a reviewer take to reproduce or test the bug or new feature?
Automated Testing & Documentation
A Cypress test should be added in a follow-up issue.
Other information
No breaking changes.