@thecb/components 11.0.1-beta.0 → 11.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.0.1-beta.0",
3
+ "version": "11.0.2-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -5,6 +5,7 @@ import { createThemeValues } from "../../../util/themeUtils";
5
5
  import { StyledExternalLink } from "./ExternalLink.styled";
6
6
  import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
7
7
  import { safeChildren } from "../../../util/general";
8
+ import { Box } from "../layouts";
8
9
 
9
10
  const ExternalLink = forwardRef(
10
11
  (
@@ -30,27 +31,39 @@ const ExternalLink = forwardRef(
30
31
  "Link",
31
32
  variant
32
33
  );
34
+ const handleKeyDown = event => {
35
+ // This is to address an issue on Safari where the link's tab order and Enter key were not being recognized
36
+ if (event.key === "Enter" || event.keyCode === 13) {
37
+ if (newTab) {
38
+ window.open(href, "_blank");
39
+ } else {
40
+ window.location.href = href;
41
+ }
42
+ }
43
+ };
33
44
 
34
45
  return (
35
- <StyledExternalLink
36
- href={href}
37
- target={newTab ? "_blank" : ""}
38
- color={themeValues.externalLinkColor}
39
- size={size}
40
- lineheight={lineHeight}
41
- weight={weight}
42
- hovercolor={themeValues.hoverColor}
43
- activeColor={themeValues.activeColor}
44
- fontFamily={themeValues.fontFamily}
45
- tabIndex={tabIndex}
46
- extrastyles={extraStyles}
47
- rel={newTab ? "noopener" : ""}
48
- data-qa={dataQa}
49
- aria-label={ariaLabel}
50
- ref={ref}
51
- >
52
- {safeChildren(children, <span />)}
53
- </StyledExternalLink>
46
+ <Box padding="0" tabIndex={tabIndex} onKeyDown={handleKeyDown}>
47
+ <StyledExternalLink
48
+ href={href}
49
+ target={newTab ? "_blank" : ""}
50
+ color={themeValues.externalLinkColor}
51
+ size={size}
52
+ lineheight={lineHeight}
53
+ weight={weight}
54
+ hovercolor={themeValues.hoverColor}
55
+ activeColor={themeValues.activeColor}
56
+ fontFamily={themeValues.fontFamily}
57
+ tabIndex="-1"
58
+ extrastyles={extraStyles}
59
+ rel={newTab ? "noopener" : ""}
60
+ data-qa={dataQa}
61
+ aria-label={ariaLabel}
62
+ ref={ref}
63
+ >
64
+ {safeChildren(children, <span />)}
65
+ </StyledExternalLink>
66
+ </Box>
54
67
  );
55
68
  }
56
69
  );
@@ -206,6 +206,7 @@ const Modal = ({
206
206
  ) : (
207
207
  <Box padding="0.5rem">
208
208
  <ButtonWithAction
209
+ tabIndex="0"
209
210
  action={hideModal}
210
211
  variant="primary"
211
212
  text={closeButtonText}