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

Focus issues when trying to add solution to unopened puzzle #2283

Open
jpd236 opened this issue Oct 1, 2024 · 1 comment
Open

Focus issues when trying to add solution to unopened puzzle #2283

jpd236 opened this issue Oct 1, 2024 · 1 comment

Comments

@jpd236
Copy link
Contributor

jpd236 commented Oct 1, 2024

Occasionally, we may need to open a puzzle and immediately mark it as solved (imagine we just solved it without first adding it to the sheet, or weren't actively editing it but now have an answer to submit, e.g. because we had to wait for HQ to evaluate a creative submission).

The natural way to do this is to open the puzzle and immediately click Answer. But what commonly happens is that you do this, and then Sheets steals focus from the dialog, so you start typing the answer into the sheet itself, which is unexpected given that the dialog should be a modal over the whole page. (Presumably this might also affect other dialogs like the "Edit" one, but it was less critical there in our experience).

One thought would be to see if there's a way we can force holding focus or reclaim it if taken by Docs/Sheets. I wonder if an onBlur listener on the dialog/text field that checks if focus has moved to somewhere within the Sheet iframe and, if so, refocuses the dialog/text field might work without causing too much disruption?

Another thought could be to provide a way to submit answers from the puzzle list view.

@jpd236
Copy link
Contributor Author

jpd236 commented Oct 18, 2024

I tried the focus hack approach, adding an onBlur handler to the answer input in the dialog which restores focus back if it is lost to the puzzle iframe.

It seems to work... okay. If I type very quickly, I can get a character into the spreadsheet before focus is restored back. That seems hard to avoid with this approach.

So it feels to me like the better approach here would be to add a way to submit answers from the list view without having to open the puzzle page. Maybe a button next to the "Open puzzle" link which launches the answer dialog?

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

No branches or pull requests

1 participant