@apify/ui-library 0.73.0 → 0.73.1-fixa11yaudit-b2e9ed.16

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": "@apify/ui-library",
3
- "version": "0.73.0",
3
+ "version": "0.73.1-fixa11yaudit-b2e9ed.16+263d6454bff",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -66,5 +66,5 @@
66
66
  "typescript": "^5.1.6",
67
67
  "typescript-eslint": "^8.24.0"
68
68
  },
69
- "gitHead": "7903abd6e4c4a66e2568e45ee76aa35a33cc15b7"
69
+ "gitHead": "263d6454bff1e09d3c9b6d4a9a62408f41c3eb2c"
70
70
  }
@@ -1,3 +1,4 @@
1
+ import type { AriaAttributes } from 'react';
1
2
  import React, { forwardRef } from 'react';
2
3
  import styled, { css } from 'styled-components';
3
4
 
@@ -27,8 +28,10 @@ export interface RegularButtonProps {
27
28
  disabled?: boolean;
28
29
  }
29
30
 
31
+ type ButtonAriaProps = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
32
+
30
33
  // Props shared for both types of the button
31
- export type CommonButtonProps = RegularButtonProps & TransientButtonProps & MarginSpacingProps;
34
+ export type CommonButtonProps = RegularButtonProps & ButtonAriaProps & TransientButtonProps & MarginSpacingProps;
32
35
  // Regular button must have onClick defined
33
36
  export type ButtonProps = CommonButtonProps & WithRequired<RegularBoxProps, 'onClick'>;
34
37
  // OR it can pass to to become anchor link - in that case onClick is not needed
@@ -89,7 +89,7 @@ interface CopyButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>
89
89
  export const CopyButton = ({ code, ...props }: CopyButtonProps) => {
90
90
  const [isCopied, handleClick] = useCopyToClipboard({ text: code });
91
91
  return (
92
- <ActionButton onClick={handleClick} data-test='copy_to_clipboard' {...props}>
92
+ <ActionButton onClick={handleClick} data-test='copy_to_clipboard' aria-label="Copy to clipboard" {...props}>
93
93
  {isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
94
94
  </ActionButton>
95
95
  );
@@ -46,12 +46,12 @@ const loadLanguages = async () => {
46
46
 
47
47
  void loadLanguages();
48
48
 
49
- type StyledPreProps = {
49
+ type PreWrapperProps = {
50
50
  $hasLinePrefixes: boolean,
51
51
  $isSingleLine: boolean
52
52
  };
53
53
 
54
- const StyledPre = styled.pre<StyledPreProps>`
54
+ const PreWrapper = styled.pre<PreWrapperProps>`
55
55
  width: 100%;
56
56
  position: relative;
57
57
  overflow: auto;
@@ -93,10 +93,10 @@ const StyledPre = styled.pre<StyledPreProps>`
93
93
  }
94
94
  `}
95
95
 
96
- ${({ $isSingleLine }) => ($isSingleLine ? css<StyledPreProps>`
96
+ ${({ $isSingleLine }) => ($isSingleLine ? css<PreWrapperProps>`
97
97
  white-space: nowrap;
98
98
  vertical-align: text-top;
99
- ` : css<StyledPreProps>`
99
+ ` : css<PreWrapperProps>`
100
100
  padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? theme.space.space8 : theme.space.space16)};
101
101
  padding-right: ${theme.space.space16};
102
102
 
@@ -153,7 +153,8 @@ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlight
153
153
  {...rest}
154
154
  >
155
155
  {({ className: prismClassName, tokens, getLineProps, getTokenProps }) => (
156
- <StyledPre
156
+ <PreWrapper
157
+ tabIndex={0}
157
158
  className={clsx(className, prismClassName)}
158
159
  $hasLinePrefixes={hasLinePrefixes}
159
160
  $isSingleLine={isSingleLine}
@@ -173,7 +174,7 @@ export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlight
173
174
  </div>
174
175
  ))}
175
176
  </Text>
176
- </StyledPre>
177
+ </PreWrapper>
177
178
  )}
178
179
  </Highlight>
179
180
  );
@@ -66,7 +66,7 @@ const TabsWrapper = styled(Box)<TabsWrapperProps>`
66
66
  display: flex;
67
67
  position: relative;
68
68
 
69
- [role='tabpanel'] {
69
+ [role='tablist'] {
70
70
  min-width: 0;
71
71
  display: flex;
72
72
  flex-grow: 1;
@@ -152,9 +152,9 @@ export const Tabs = ({ variant = 'default', tabs, activeTab, onSelect, ...props
152
152
  setOveflowState(isTabsOverflowing(event.currentTarget as HTMLDivElement));
153
153
  }, []);
154
154
 
155
- return <TabsWrapper {...props} role="tablist" data-test="tabs-wrapper" $variant={variant}>
155
+ return <TabsWrapper {...props} data-test="tabs-wrapper" $variant={variant}>
156
156
  <div role="cell" aria-hidden={!overflowState?.left} />
157
- <div ref={ref} role="tabpanel" onScroll={scrollHandler}>
157
+ <div ref={ref} role="tablist" onScroll={scrollHandler}>
158
158
  {tabs.map((tab) => (
159
159
  <Tab
160
160
  {...tab}
@@ -83,6 +83,7 @@ export const PaginationButtons: FC<PaginationButtonsProps> = ({
83
83
  disabled={page <= 0}
84
84
  onClick={() => onPageChange(page - 1)}
85
85
  trackingId='PaginationPrevPage'
86
+ aria-label="Previous page"
86
87
  >
87
88
  <ChevronLeftIcon size="16" />
88
89
  </PaginationButtonBase>
@@ -128,6 +129,7 @@ export const PaginationButtons: FC<PaginationButtonsProps> = ({
128
129
  disabled={page >= totalPages - 1}
129
130
  onClick={() => onPageChange(page + 1)}
130
131
  trackingId='PaginationNextPage'
132
+ aria-label="Next page"
131
133
  >
132
134
  <ChevronRightIcon size="16" />
133
135
  </PaginationButtonBase>