Skip to content

nicer action exercise #326

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

Merged
merged 2 commits into from
Apr 6, 2023
Merged

nicer action exercise #326

merged 2 commits into from
Apr 6, 2023

Conversation

Rich-Harris
Copy link
Member

This adds a more engaging and understandable exercise for actions.

Unfortunately it reveals a bug — it's currently impossible to complete the exercise, because the iframe keeps snatching the focus. I'm not sure if that's something that broke recently or if this was always broken, but it would be good to fix it if possible.

If not, the workaround would be to not show the menu initially, but that would be sad.

@vercel
Copy link

vercel bot commented Apr 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
learn-svelte-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 6, 2023 2:20am

@Rich-Harris
Copy link
Member Author

Okay I think I figured it out — the iframe_took_focus event is now fired for all focusin events inside the iframe unless they're the result of user action, using the following heuristic:

  • if the focusin event happened while a pointer or key was down, it was user initiated
  • if the target is <body> and there's a relatedTarget, it was user initiated (on hydration, <body> will be focused, but there'll be no relatedTarget)

In all other cases, the editor should regain focus if the iframe steals it.

@Rich-Harris Rich-Harris merged commit b0e2f6e into main Apr 6, 2023
@Rich-Harris Rich-Harris deleted the action-exercise branch April 6, 2023 02:24
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.

1 participant