Skip to content

Conversation

@ValeraS
Copy link
Contributor

@ValeraS ValeraS commented Apr 17, 2021

Prior Safari 14, MediaQueryList does not have method addEventListener,
use addListener for backward compatibility, which is supported by all browsers.

This PR fixes microsoft/monaco-editor#2432

@ValeraS ValeraS force-pushed the fix/safari-media-query branch 2 times, most recently from 2f9d214 to 03f14bc Compare April 19, 2021 16:41
Copy link

@glaukiol1 glaukiol1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple fix, thanks for contributing! Approved by me

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot accept the PR as is. MDN strongly discourages using addListener. At least this should be done that it first checks if addEventListener exists and if not, then fall back to addListener.

https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener

image

lists

Prior Safari 14, MediaQueryList does not have method addEventListener,
use addListener for backward compatibility, which is supported by all
browsers.

fixes microsoft/monaco-editor#2432
@ValeraS ValeraS force-pushed the fix/safari-media-query branch from 03f14bc to db5cb92 Compare April 30, 2021 09:17
@ValeraS ValeraS requested a review from alexdima April 30, 2021 09:19
@alexdima alexdima added this to the May 2021 milestone Apr 30, 2021
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We are currently locking down our main for the upcoming vscode release, I will merge this early next week.

@tenphi
Copy link

tenphi commented May 11, 2021

Thanks for the contribution. @ValeraS
A gentle reminder for @alexdima about merging this PR. It's hard to monkey-patch or polyfill this. We have a few complaining users.

@alexdima alexdima merged commit 37a12c9 into microsoft:main May 12, 2021
@ValeraS ValeraS deleted the fix/safari-media-query branch May 12, 2021 13:59
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monaco editor is not working in Safari 13.1

4 participants