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

[Bug]: Using Toolbar is making it not possible to use tab key in monaco editor #31526

Open
2 tasks done
dickwyn opened this issue May 30, 2024 · 3 comments
Open
2 tasks done

Comments

@dickwyn
Copy link
Member

dickwyn commented May 30, 2024

Library

React Components / v9 (@fluentui/react-components)

System Info

System:
    OS: Windows 10 10.0.22631
    CPU: (16) x64 Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
    Memory: 38.28 GB / 63.95 GB
  Browsers:
    Edge: Chromium (124.0.2478.97)
    Internet Explorer: 11.0.22621.3527

Are you reporting Accessibility issue?

yes

Reproduction

https://codesandbox.io/p/sandbox/toolbar-monaco-editor-y9drxt?file=%2Fsrc%2Fexample.tsx

Bug Description

Actual Behavior

in the monaco editor, when i click tab, it shifts the focus to other elements. note: shift + tab works. when i remove the <Toolbar> tabbing in the monaco editor works correctly

Expected Behavior

i'm able to use the tab key to add spaces in the monaco editor

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@marcgabe15
Copy link

I had the same issue. Looks like it was tabster. I followed this link microsoft/tabster#384 to check
document.addEventListener('tabster:movefocus', e => ...)

Then, based on this other bug microsoft/tabster#316 adding data-tabster='{"uncontrolled": {}}' to Monaco Editor did the trick

Example:
<Editor data-tabster='{"uncontrolled": {}}' className={styles.monacoContainer} defaultValue="test123" />

It looks like you can also use useUncontrolledFocus as well https://react.fluentui.dev/?path=/docs/utilities-focus-management-useuncontrolledfocus--default which is just the wrapper to data-tabster='{"uncontrolled": {}}

@dickwyn
Copy link
Member Author

dickwyn commented Jun 21, 2024

thanks @marcgabe15 for the suggestion! that workaround did indeed work for me!

@bk201-
Copy link

bk201- commented Nov 18, 2024

@marcgabe15 Unfortunately this trick doesn't work for me.
I use @fluentui/react-components version 9.56.2. Adding this data-attribute does nothing. I have on my page many components: Toaster, Toolbar, Dialog, etc

UPD: I did small investigation. This trick works only after monaco editor there are any element what can take a focus. If editor is a last element in the focus line, tabster can't find next element to set focus and decides that keypress was outside of a DOM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants