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

In the Playground Editor of a document, the Editor Tab and Options Tab automatically lose focus after switching between them. #1993

Closed
4 tasks done
declanchiu opened this issue Mar 31, 2022 · 13 comments
Labels
🕸 area/website This affects the website 💪 phase/solved Post is done

Comments

@declanchiu
Copy link
Contributor

Initial checklist

Affected packages and versions

2.1.0

Link to runnable example

No response

Steps to reproduce

Click on the Playground page, first enter the content in the Editor tab, then click on the options tab and then come back to the Editor tab to enter the content, then the focus will be lost automatically.

👉 https://mdxjs.com/playground/

I am still in process in learning English. Sorry!😜

image

Expected behavior

The editor should type normally after switching tab selections

Actual behavior

The editor is behaving unusually out of focus after switching the Tab

Runtime

No response

Package manager

No response

OS

macOS

Build and bundle tools

No response

@wooorm
Copy link
Member

wooorm commented Mar 31, 2022

Weird!

Are you perhaps interested in investigating the problem? Perhaps this is a problem with them? Or we need to change something in the tabs here?

@wooorm wooorm added 👍 phase/yes Post is accepted and can be worked on 🕸 area/website This affects the website labels Mar 31, 2022
@declanchiu
Copy link
Contributor Author

I would be more than happy to look into it 🦾

@declanchiu
Copy link
Contributor Author

@wooorm reactjs/react-tabs#451
There are already corresponding issues, and it is indeed a problem with react-tabs

@danez
Copy link

danez commented Mar 31, 2022

Hello :)

So I just released version v4.2.0 of react-tabs, which includes a fix for the focus.

The problem here in this ticket is different though: The behavior for focus changed in v4 so that tabs are instantly focused on click to allow instant keyboard navigation. To disable this again I added a new prop focusTabOnClick, which disables this and does not mess with focus on click: https://github.com/reactjs/react-tabs#focustabonclick-boolean

This should make react-tabs not focus itself on click and leave the focus untouched. Can you check if this helps?

@wooorm
Copy link
Member

wooorm commented Apr 1, 2022

Thanks Daniel!

@PlayGuitar-CoderQ Could you try that?

@declanchiu
Copy link
Contributor Author

No problem, I'll check it out.

@declanchiu
Copy link
Contributor Author

@wooorm But I'm running mdx according to the contribution guide and there's an error reported that I haven't understood what's causing it. 🤔

image

@wooorm
Copy link
Member

wooorm commented Apr 2, 2022

Hmm I believe currently you need to be on Node 14 for this.
I'll check later and update the docs.

@declanchiu
Copy link
Contributor Author

Thanks, It's true that my version of node is too high.

After I ran the run docs for the first time

I ran index.html under public on the local server and found that index.css was introducing errors and that the page was not styled

image

@wooorm
Copy link
Member

wooorm commented Apr 2, 2022

You should be able to create a server inside the public/ folder, then the styles should work.

@declanchiu
Copy link
Contributor Author

Thank you for your patience and answers 👍.

I have successfully run and tested react-tabs@4.2.0 to resolve this issue, so just upgrade react-tabs.😁
gif picture:👇

Large GIF (602x336)

declanchiu added a commit to declanchiu/mdx that referenced this issue Apr 3, 2022
@declanchiu
Copy link
Contributor Author

@danez Thanks Daniel! I have tested your fix with no problems.
I was going to try to fix this, but you fixed it quickly. 👍👍

@wooorm wooorm closed this as completed in cbaee28 Apr 4, 2022
@wooorm wooorm added 💪 phase/solved Post is done and removed 👍 phase/yes Post is accepted and can be worked on labels Apr 4, 2022
@wooorm
Copy link
Member

wooorm commented Apr 4, 2022

Thanks @PlayGuitar-CoderQ for the pull request, and @danez for the upstream fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕸 area/website This affects the website 💪 phase/solved Post is done
Development

No branches or pull requests

3 participants