diff --git a/frontend/package.json b/frontend/package.json index 6ecb7057a2..466e51668d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -149,7 +149,8 @@ "coveragePathIgnorePatterns": [ "/src/index.js", "/src/setupProxy.js", - "/src/pages/NotFound/index.js" + "/src/pages/NotFound/index.js", + "/src/polyfills.js" ], "coverageThreshold": { "global": { diff --git a/frontend/src/index.js b/frontend/src/index.js index 55ed3a1205..ecbb3f53d6 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,5 +1,6 @@ import 'react-app-polyfill/ie11'; import 'react-app-polyfill/stable'; +import './polyfills'; import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; diff --git a/frontend/src/pages/Landing/Filter.js b/frontend/src/pages/Landing/Filter.js index d1ec1d8ac9..d525f6b609 100644 --- a/frontend/src/pages/Landing/Filter.js +++ b/frontend/src/pages/Landing/Filter.js @@ -76,6 +76,10 @@ function Filter({ applyFilters, forMyAlerts }) { // https://reactjs.org/docs/events.html#detecting-focus-entering-and-leaving // e.relatedTarget can be null when focus changes within the menu (when using VoiceOver) + /** + * We check for these because if we don't, the filter menu will abruptly close when the calendar day + * or the month navigation buttons are clicked, rendering the date picker un-usable + */ const isCalendarControl = e.target.matches('.CalendarDay, .DayPickerNavigation_button'); if (!isCalendarControl && !e.currentTarget.contains(e.relatedTarget)) { diff --git a/frontend/src/polyfills.js b/frontend/src/polyfills.js new file mode 100644 index 0000000000..3d0cadfe02 --- /dev/null +++ b/frontend/src/polyfills.js @@ -0,0 +1,4 @@ +if (!Element.prototype.matches) { + Element.prototype.matches = Element.prototype.msMatchesSelector + || Element.prototype.webkitMatchesSelector; +}