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

Dont reset cursor on window blur #276

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

jared-hughes
Copy link

Alt-tab to a different window or Ctrl+Tab to a different tab, then switch back. Current behavior with resetCursorOnBlur: true (which Desmos has) is to move the cursor to the end of the math field. Now, leave the cursor where it is.

In Desmos: resetCursorOnBlur is used to ensure there's not a different cursor state for each mq field in the expressions list. When the user selects a new field (or clicks away from all fields), the cursor on the old one resets to the end of the field.

Switching to a different tab/window doesn't change which field is selected, so it's okay to leave the cursor where it is.

I don't think this PR can be tested with mathquill's testing framework. focusBlur.test.js handles regular blurs but not window blurs.

@jared-hughes jared-hughes requested review from a team and mikehaverstock and removed request for a team February 29, 2024 22:02
@mikehaverstock
Copy link
Member

Do you have a knox PR up to test this out? I'd like to play with this some.

@jared-hughes
Copy link
Author

jared-hughes commented Mar 1, 2024

@mikehaverstock
Copy link
Member

Ok so this makes sense to me that we can detect that we blurred the window and therefore don't reset the cursor position. Where do we put focus back in the mathquill when the window regains focus? I was seeing the mathquill regain focus with the cursor in the same position. That part doesn't make sense to me. It's great. I just don't understand the magic.

@jared-hughes jared-hughes merged commit a0d9281 into main Mar 4, 2024
4 checks passed
@jared-hughes jared-hughes deleted the window-blur-dont-reset-cursor branch March 4, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants