main ← fix-safari-chat-upload
opened 03:33PM - 16 Jan 26 UTC
The file picker wasn't opening when clicking "Attach a file" from the chat compo…ser dropdown menu on desktop Safari.
Safari requires programmatic file input clicks to happen synchronously within the user gesture event chain. The previous code used `await closeFn()` before calling `button.action()`, which broke this chain by deferring execution to a new microtask. Safari no longer considered the subsequent `.click()` to be user-initiated.
The fix removes the async/await to keep both calls synchronous within the original click handler.
This issue cannot be caught by automated tests because our system specs use Chrome, which is more permissive with user activation (allowing a ~5 second window after user interaction). Safari's stricter requirements only manifest in that specific browser.
References:
- https://meta.discourse.org/t/393639
- https://webkit.org/blog/13862/the-user-activation-api/
- https://macwright.com/2022/07/11/activation.html