Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Workaround to prevent Monaco loose a focus and handle "tab" key as text modifier #2433

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

bk201-
Copy link
Contributor

@bk201- bk201- commented Nov 19, 2024

Fixes #2431

This pull request includes changes to the MonacoEditor component in src/webviews/MonacoEditor.tsx to improve focus management and accessibility. The most important changes include importing a new hook, using the hook to manage focus, and updating the component's return structure to include an input element for accessibility.

Focus management improvements:

  • src/webviews/MonacoEditor.tsx: Imported the useUncontrolledFocus hook from @fluentui/react-components.
  • src/webviews/MonacoEditor.tsx: Utilized the useUncontrolledFocus hook within the MonacoEditor component to manage focus attributes.
  • src/webviews/MonacoEditor.tsx: Updated the return structure of the MonacoEditor component to include a section element with focus attributes and an input element to prevent losing focus from the editor.

@bk201- bk201- requested review from a team as code owners November 19, 2024 13:59
@tnaum-ms
Copy link
Collaborator

I reviewed the functionality of this PR and did not observe any negative side effects.

I added a change to make the input box invisible.

However, I am unsure how to verify whether the solution remains "accessible" for screen readers and other assistive technologies.
@sevoku Is it a manual check or is there a tool that we could run here?

@sevoku
Copy link
Member

sevoku commented Nov 19, 2024

It'd be a manual check, however if it's still accessible using Narrator, it'd be rather a usability issue, so let's have a separate follow up bug and fix it later in that case (or it gets fixed upstream).

@tnaum-ms
Copy link
Collaborator

Okay, I gave it a try with the Narrator. With and without this PR, usability with Narrator is frustrating. However, regarding this PR, it’s not a step backward.

@bk201- bk201- merged commit 25c6458 into main Nov 20, 2024
2 checks passed
@bk201- bk201- deleted the dev/sda/prevent-monaco-loose-focus branch November 20, 2024 09:51
@microsoft microsoft locked and limited conversation to collaborators Jan 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tab key doesn't insert a TAB into Query Entry and Document editor
3 participants