Skip to content

Commit

Permalink
[Conhost] Notify UIA when letter deleted via backspace (microsoft#12735)
Browse files Browse the repository at this point in the history
## Summary of the Pull Request
Fixes a bug in ConHost where Narrator wouldn't read the deleted letter after the user pressed backspace.

## References
MSFT:31748387

## Detailed Description of the Pull Request / Additional comments
`WriteCharsLegacy()` already calls `NotifyAccessibilityEventing()` when text is inserted into the buffer ([see code](https://github.com/microsoft/terminal/blob/855e1360c0ff810decf862f1d90e15b5f49e7bbd/src/host/_stream.cpp#L559-L563)). However, when backspace is pressed, the entire if-condition is skipped over, resulting in the accessibility event not being fired. `WriteCharsLegacy()` has a separate branch that is dedicated to handling backspace, so I added a call to the relevant logic to notify UIA at the end of that.

## Validation Steps Performed
✅ <kbd>Backspace</kbd> deletes a character and Narrator reads it
✅ <kbd>Backspace</kbd> still works with NVDA and JAWS (unchanged behavior)
✅ if the input buffer had wrapped text, the above scenario works as expected
✅ scenario works for CMD, PowerShell Core, and WSL
  • Loading branch information
carlos-zamora authored Mar 23, 2022
1 parent d97d9f0 commit eddeaab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/host/_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,15 @@ using Microsoft::Console::VirtualTerminal::StateMachine;
Status = AdjustCursorPosition(screenInfo, CursorPosition, dwFlags & WC_KEEP_CURSOR_VISIBLE, psScrollY);
}
}
// Notify accessibility to read the backspaced character.
// See GH:12735, MSFT:31748387
if (screenInfo.HasAccessibilityEventing())
{
if (IConsoleWindow* pConsoleWindow = ServiceLocator::LocateConsoleWindow())
{
LOG_IF_FAILED(pConsoleWindow->SignalUia(UIA_Text_TextChangedEventId));
}
}
break;
}
case UNICODE_TAB:
Expand Down

0 comments on commit eddeaab

Please sign in to comment.