diff --git a/client/src/components/CommentApp/components/CommentHeader/index.tsx b/client/src/components/CommentApp/components/CommentHeader/index.tsx index 032b424075..b3e4623d44 100644 --- a/client/src/components/CommentApp/components/CommentHeader/index.tsx +++ b/client/src/components/CommentApp/components/CommentHeader/index.tsx @@ -5,9 +5,46 @@ import React, { FunctionComponent, useState, useEffect, useRef } from 'react'; import Icon from '../../../Icon/Icon'; import type { Store } from '../../state'; import { TranslatableStrings } from '../../main'; +import { IS_IE11 } from '../../../../config/wagtailConfig'; import { Author } from '../../state/comments'; +// Details/Summary components that just become
/ tags +// except for IE11 where they become
tags to allow us to style them +const Details: React.FunctionComponent> = ({ children, open, ...extraProps }) => { + if (IS_IE11) { + return ( +
+ {children} +
+ ); + } + + return ( +
+ {children} +
+ ); +}; + +const Summary: React.FunctionComponent> = ({ children, ...extraProps }) => { + if (IS_IE11) { + return ( + + ); + } + + return ( + + {children} + + ); +}; interface CommentReply { author: Author | null; @@ -84,8 +121,8 @@ export const CommentHeader: FunctionComponent = ({ } {(onEdit || onDelete) &&
-
- + = ({ aria-expanded={menuOpen} > - +
{onEdit && } {onDelete && }
-
+
} diff --git a/client/src/components/CommentApp/components/CommentHeader/style.scss b/client/src/components/CommentApp/components/CommentHeader/style.scss index f15d87474c..6dd6de30df 100644 --- a/client/src/components/CommentApp/components/CommentHeader/style.scss +++ b/client/src/components/CommentApp/components/CommentHeader/style.scss @@ -38,7 +38,8 @@ } > button, - > details > summary { + > details > summary, + .details-fallback > .details-fallback__summary { // IE11 uses divs instead with these classes // Hides triangle on Firefox list-style-type: none; // Hides triangle on Chrome @@ -65,7 +66,8 @@ } } - > details { + > details, + > .details-fallback { // IE11 uses divs instead with these classes position: relative; > div { @@ -77,14 +79,16 @@ &--resolve { > button, - > details > summary { + > details > summary, + > .details-fallback > .details-fallback__summary { // IE11 uses divs instead with these classes color: $color-teal; } } &--more { > button, - > details > summary { + > details > summary, + > .details-fallback > .details-fallback__summary { // IE11 uses divs instead with these classes color: $color-grey-25; } } @@ -112,8 +116,8 @@ button { display: block; - background: unset; - border: unset; + background: none; + border: 0; color: #fff; padding: 5px 10px; font-size: 13px; @@ -132,3 +136,12 @@ .comment-reply--mode-deleting .comment-header { opacity: 0.5; } + +// IE11 only uses these classes +.details-fallback .comment-header__more-actions { + display: none; +} + +.details-fallback--open .comment-header__more-actions { + display: block; +} diff --git a/client/src/entrypoints/admin/comments.js b/client/src/entrypoints/admin/comments.js index ae4e15a893..73d9236f4a 100644 --- a/client/src/entrypoints/admin/comments.js +++ b/client/src/entrypoints/admin/comments.js @@ -95,7 +95,12 @@ window.comments = (() => { this.setOnClickHandler(localId); } onDelete() { - this.node.remove(); + // IE11 + if (!this.node.remove) { + this.node.parentNode.removeChild(this.node); + } else { + this.node.remove(); + } if (this.unsubscribe) { this.unsubscribe(); } @@ -257,7 +262,7 @@ window.comments = (() => { commentsElement, commentsOutputElement, data.user, data.comments, new Map(Object.entries(data.authors)), STRINGS ); - formElement.querySelectorAll('[data-component="add-comment-button"]').forEach(initAddCommentButton); + Array.from(formElement.querySelectorAll('[data-component="add-comment-button"]')).forEach(initAddCommentButton); // Attach the commenting app to the tab navigation, if it exists const tabNavElement = formElement.querySelector('[data-tab-nav]'); diff --git a/client/src/utils/polyfills.js b/client/src/utils/polyfills.js index 9de8e7b06a..5b41a23cc6 100644 --- a/client/src/utils/polyfills.js +++ b/client/src/utils/polyfills.js @@ -10,3 +10,5 @@ import 'whatwg-fetch'; import 'element-closest'; // IE11 import 'formdata-polyfill'; +// IE11 +import 'url-search-params-polyfill'; diff --git a/package-lock.json b/package-lock.json index 60d694fdf6..1d18093d34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15611,6 +15611,11 @@ } } }, + "url-search-params-polyfill": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/url-search-params-polyfill/-/url-search-params-polyfill-8.1.1.tgz", + "integrity": "sha512-KmkCs6SjE6t4ihrfW9JelAPQIIIFbJweaaSLTh/4AO+c58JlDcb+GbdPt8yr5lRcFg4rPswRFRRhBGpWwh0K/Q==" + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/package.json b/package.json index e24f580e11..0eba2c3efb 100644 --- a/package.json +++ b/package.json @@ -107,6 +107,7 @@ "redux-thunk": "^2.3.0", "reselect": "^4.0.0", "telepath-unpack": "^0.0.3", + "url-search-params-polyfill": "^8.1.1", "uuid": "^8.3.2", "whatwg-fetch": "^2.0.3" },