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
fix: media shouldn't open permissions dialog #31805
Conversation
It'd be great if backport to 15-x-y could be released with this change. Our weekly release pipeline is currently blocked because of this issue 😭 |
f9e9023
to
84d3493
Compare
Playing media shouldn't open Accessibility permissions dialog on macOS. However, we still need to watch for media events, just not globally and `media_keys_listener_` is an API over global capture of the media keys. The fix is to let chromium call `UpdateWhichKeysAreListenedFor` which will call `UpdateSystemMediaControlsEnabledControls` and watch for events on `system_media_controls_` without triggering permissions popup.
84d3493
to
cd30fe8
Compare
Nevermind, I forgot that |
Added update to the patches as suggested by CircleCI. |
FWIW, 13-x-y might need the back port too. We don’t use it at our company anymore, but the issue is present there as well. thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @indutny!
I pulled the changes locally and tested - this patch change looks good to me, but I'd like a second opinion from another maintainer with a little more experience with the media APIs before we merge 👍
+#endif // defined(OS_MAC) | ||
+ should_start_watching && | ||
+ media_keys_listener_ && | ||
!media_keys_listener_->StartWatchingMediaKey(key_code)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
media_keys_listener_
is implemented by ui/base/accelerators/media_keys_listener_mac.mm
and it provides API for listening for media keys globally. In fact, the code in media_kes_listener_mac.mm
calls CGEventTapCreate
whenever new media key is watched and this immediately causes an Accessibility popup to appear since this permission is required for CGEventTapCreate
to function at all.
- media_keys_listener_ = ui::MediaKeysListener::Create( | ||
- this, ui::MediaKeysListener::Scope::kGlobal); | ||
- DCHECK(media_keys_listener_); | ||
- } | ||
+ // This is required for proper functioning of MediaMetadata. | ||
+ system_media_controls_->AddObserver(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trick thus is to let system_media_controls_
handle the keystroke whenever we have internal handling enabled (i.e. when there are no global accelerators assigned for a media key in electron), so we check media_key_handling_enabled_
above and fall through here if it is false
(meaning that there are no accelerators in electron).
Thanks @VerteDinde ! I added a few comments to clarify what I've done in the patch. Hope it helps! |
Thanks for reviews, everyone! @codebytere is there a chance you could take a look at this? You've submitted the original fix so I'd appreciate a review from you a lot 🤗 |
Fantastic, thanks @codebytere ! Please let me know if there's any additional action that I should take before this commit can be merged and backported. I'll be happy to help in any way (in part because we wish to get the update with the next 15-x-y release 😁) |
Release Notes Persisted
|
I have automatically backported this PR to "15-x-y", please check out #31836 |
I have automatically backported this PR to "16-x-y", please check out #31837 |
Yaaay! Thank you! |
Could this be backported to 14? 14.2.1 displays the same issue. |
* fix: media shouldn't open permissions dialog Playing media shouldn't open Accessibility permissions dialog on macOS. However, we still need to watch for media events, just not globally and `media_keys_listener_` is an API over global capture of the media keys. The fix is to let chromium call `UpdateWhichKeysAreListenedFor` which will call `UpdateSystemMediaControlsEnabledControls` and watch for events on `system_media_controls_` without triggering permissions popup. * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Description of Change
Playing media shouldn't open Accessibility permissions dialog on macOS.
However, we still need to watch for media events, just not globally and
media_keys_listener_
is an API over global capture of the media keys.The fix is to let chromium call
UpdateWhichKeysAreListenedFor
whichwill call
UpdateSystemMediaControlsEnabledControls
and watch forevents on
system_media_controls_
without triggering permissions popup.Fix: #31558
cc @codebytere
Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where playing media would open Accessibility permissions dialog on macOS.