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

Don't focus textarea on tapstart for static math #314

Closed
wants to merge 1 commit into from

Conversation

eluberoff
Copy link
Member

We only need focus when something is selected, and the fact that we were focusing prematurely resulted in some small behavior inconsistencies between the first and second time e.g. that you'd click on a static table cell in the calculator.

Problem this solves (very subtle, but noticeable if you follow these exact steps)

(1) open www.desmos.com/calculator
(2) type "sqrt(2)"
(3) click on the graph paper to deselect the expression
(4) mousedown somewhere inside of the number, but don't mouse up yet!
--note: the expression immediately selects, before the mouse up.
(5) click back on the graphpaper to deselect the expression
(6) mousedown on the 4 again, and again don't mouse up yet.
--note: now the expression doesn't select yet--

it will select if you either:
(a) move the mouse to start selection --or--
(b) complete the tap, which causes us to call .select() on the mathquill, which again cause focus to enter the textarea and bubble up

I prefer the second behavior -- no focus until we need it.

we only need focus when something is selected, and the fact that
we were focusing prematurely resulted in some small behavior inconsistencies
between the first and second time e.g. that you'd click on a static table
cell in the calculator
@jared-hughes
Copy link

I'm not able to reproduce your observations.

  • In a regular evaluation (sqrt(2) in a blank line), it doesn't select on mousedown, only on mousemove or mouseup.
  • In a table evaluation, it selects on mousedown. I'm not seeing any difference between the first time (A) that I mousedown and the second time (B).

setInterval(() => console.log(Calc.controller.getSelectedExpressionIds()), 300) gives the same results as the UI suggests (the selected expressions are blue), and setInterval(() => console.log(Desmos.Private.Fragile.MathquillView.getFocusedMathquill()), 300) is undefined if all you're selecting are static.

For table, I'm following the steps:

  1. Open https://www.desmos.com/calculator
  2. Type "sqrt 2" to get \sqrt{2} -- graph.
  3. (A) Click on the graph paper to deselect the expression
  4. Mousedown on the 4 of the 1.41421... inside the table, but don't mouse up yet. -- the expression immediately selects before the mouseup
  5. Mouseup
  6. (B) Click back on the graphpaper to deselect.
  7. Mousedown on the 4 of the 1.41421... inside the table, but don't mouse up yet. -- the expression immediately selects before the mouseup
  8. Mouseup

@eluberoff
Copy link
Member Author

hm, I can't repro this anymore also. closing

@eluberoff eluberoff closed this Nov 27, 2024
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