jwplayer / ott-web-app

Reference implementation for JWP-powered apps
Apache License 2.0
70 stars 52 forks source link

Fix / lose focus after activating share button #502

Closed ChristiaanScheermeijer closed 5 months ago

ChristiaanScheermeijer commented 5 months ago

Description

When activating the share button, the focus is lost because of the select and copy action. This change stores the document activeElement and restoring focus after the copy command.

Should we be using Clipboard APIs? 🤔

Steps completed:

According to our definition of done, I have completed the following steps:

github-actions[bot] commented 5 months ago

Visit the preview URL for this PR (updated for commit 9f7236e):

https://ottwebapp--pr502-fix-focus-lost-after-rpye9koi.web.app

(expires Thu, 16 May 2024 13:19:53 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c198f8a3a199ba8747819f7f1e45cf602b777529

AntonLantukh commented 5 months ago

@ChristiaanScheermeijer clipboard.writeText looks pretty safe, any concerns?

ChristiaanScheermeijer commented 5 months ago

@ChristiaanScheermeijer clipboard.writeText looks pretty safe, any concerns?

It should be safe and use transient permissions, which means the user has to interact with the page.

But changing the implementation is not in the scope of this fix 😄