Skip to content

Commit

Permalink
Fix IE11 on clicking on transcript will throw exception of matches (#…
Browse files Browse the repository at this point in the history
…4387)

* Fix matches and prop type

* Add entry

* Update entry
  • Loading branch information
compulim authored Aug 10, 2022
1 parent 7f35626 commit 7969fde
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes [#4211](https://github.com/microsoft/BotFramework-WebChat/issues/4211). Screen reader should read when an activity was failed to send, by [@compulim](https://github.com/compulim), in PR [#4362](https://github.com/microsoft/BotFramework-WebChat/pull/4362), also fixed:
- The "send failed" status on the activity should show up as soon as the chat adapter failed to send the activity
- Fixes [#4312](https://github.com/microsoft/BotFramework-WebChat/issues/4312). `groupActivityMiddleware` returning invalid value should not throw exceptions, by [@compulim](https://github.com/compulim), in PR [#4378](https://github.com/microsoft/BotFramework-WebChat/pull/4378).
- Fixes [#4386](https://github.com/microsoft/BotFramework-WebChat/issues/4386). Clicking on Adaptive Cards should not throw exception under IE11, by [@compulim](https://github.com/compulim), in PR [#4387](https://github.com/microsoft/BotFramework-WebChat/pull/4387), also fixed:
- Prop type warning should not be shown for `<ActivityRow>`

## Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export default function closest(element: HTMLElement, selector: string): HTMLEle
let current: HTMLElement | null = element;

while (current) {
if (current.matches(selector)) {
// "msMatchesSelector" is vendor-prefixed version of "matches".
// eslint-disable-next-line dot-notation
if ((current.matches || (current['msMatchesSelector'] as (selector: string) => boolean)).call(current, selector)) {
return current;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/component/src/BasicTranscript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ InternalTranscript.defaultProps = {
className: ''
};

InternalTranscript.displayName = 'InternalTranscript';

InternalTranscript.propTypes = {
// PropTypes cannot validate precisely with its TypeScript counterpart.
// @ts-ignore
Expand Down
4 changes: 3 additions & 1 deletion packages/component/src/Transcript/ActivityRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ ActivityRow.defaultProps = {
children: undefined
};

ActivityRow.displayName = 'ActivityRow';

ActivityRow.propTypes = {
// PropTypes cannot fully capture TypeScript type.
// @ts-ignore
Expand All @@ -117,7 +119,7 @@ ActivityRow.propTypes = {
'webchat:fallback-text': PropTypes.string
})
}).isRequired,
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
children: PropTypes.any
};

export default ActivityRow;
4 changes: 3 additions & 1 deletion packages/component/src/Utils/firstTabbableDescendant.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function orSelf(element) {
return;
}

if (element.matches(SELECTOR)) {
// "msMatchesSelector" is vendor-prefixed version of "matches".
// eslint-disable-next-line dot-notation
if ((element.matches || element['msMatchesSelector']).call(element, SELECTOR)) {
return element;
}

Expand Down
11 changes: 10 additions & 1 deletion packages/component/src/hooks/internal/useObserveFocusVisible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,16 @@ function useObserveFocusVisibleForModernBrowsers(
onFocusVisibleRef: MutableRefObject<() => void>
) {
const handleFocus = useCallback(() => {
if (targetRef.current.matches(':focus-visible')) {
const { current } = targetRef;

if (
// "msMatchesSelector" is vendor-prefixed version of "matches".
// eslint-disable-next-line dot-notation
(current.matches || (current['msMatchesSelector'] as (selector: string) => boolean)).call(
current,
':focus-visible'
)
) {
onFocusVisibleRef?.current();
}
}, [onFocusVisibleRef, targetRef]);
Expand Down

0 comments on commit 7969fde

Please sign in to comment.