Skip to content

fix(my-pages): documents a11y issues #18823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/portals/my-pages/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export const Header = ({ position, includeSearchInHeader = false }: Props) => {
size="small"
type="span"
variant="utility"
aria-label={formatMessage(m.openDocuments)}
unfocusable
/>
<span className={helperStyles.srOnly}>
Expand Down Expand Up @@ -183,6 +184,7 @@ export const Header = ({ position, includeSearchInHeader = false }: Props) => {
? setMenuOpen(undefined)
: setMenuOpen('side')
}}
aria-label={formatMessage(m.overview)}
ref={ref}
>
<Hidden below="sm">{formatMessage(m.overview)}</Hidden>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const SearchInput = ({
<AsyncSearch
ref={ref}
id="my-pages-async-search"
ariaLabel={buttonAriaLabel}
placeholder={placeholder}
size={size === 'large' ? 'semi-large' : 'medium'}
colored={!whiteMenuBackground}
Expand Down
3 changes: 3 additions & 0 deletions libs/island-ui/core/src/lib/AsyncSearch/AsyncSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type AsyncSearchOption = {
export interface AsyncSearchProps {
id?: string
label?: string
ariaLabel?: string
placeholder?: string
options: AsyncSearchOption[]
colored?: boolean
Expand Down Expand Up @@ -72,6 +73,7 @@ export const AsyncSearch = forwardRef<HTMLInputElement, AsyncSearchProps>(
{
id = 'asyncsearch-id',
label,
ariaLabel,
placeholder,
size = 'medium',
colored,
Expand Down Expand Up @@ -225,6 +227,7 @@ export const AsyncSearch = forwardRef<HTMLInputElement, AsyncSearchProps>(
buttonProps={{
onFocus,
onBlur,
'aria-label': ariaLabel,
...(onSubmit
? {
onClick: () => {
Expand Down
1 change: 1 addition & 0 deletions libs/island-ui/core/src/lib/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const Button = forwardRef<
<Box
component={ReaButton}
as={as ? (as as string) : variant === 'text' ? 'span' : 'button'}
role={as ? undefined : 'button'}
ref={ref}
value={value}
name={name}
Expand Down
3 changes: 3 additions & 0 deletions libs/island-ui/core/src/lib/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface CheckboxProps {
name?: string
id?: string
label?: React.ReactNode
ariaLabel?: string
checked?: boolean
disabled?: boolean
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
Expand All @@ -38,6 +39,7 @@ interface AriaError {
export const Checkbox = ({
label,
subLabel,
ariaLabel,
labelVariant = 'default',
name,
id = name,
Expand Down Expand Up @@ -103,6 +105,7 @@ export const Checkbox = ({
onChange={onChangeHandler}
value={value}
checked={checked}
aria-label={ariaLabel}
{...(ariaError as AriaError)}
/>
<label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const PdfDocument: React.FC<PdfDocumentProps> = ({
icon="remove"
variant="ghost"
size="small"
aria-label={formatMessage(messages.zoomIn)}
onClick={() => setScalePDF(scalePDF - 0.1)}
disabled={0.6 > scalePDF}
/>
Expand All @@ -61,6 +62,7 @@ export const PdfDocument: React.FC<PdfDocumentProps> = ({
display="flex"
justifyContent="center"
alignItems="center"
aria-label={formatMessage(messages.zoomLevel)}
>
<Text variant="small">
{((scalePDF / initScale) * 100).toFixed(0) + '%'}
Expand All @@ -71,6 +73,7 @@ export const PdfDocument: React.FC<PdfDocumentProps> = ({
icon="add"
variant="ghost"
size="small"
aria-label={formatMessage(messages.zoomIn)}
onClick={() => {
setScalePDF(scalePDF + 0.1)
}}
Expand All @@ -83,6 +86,7 @@ export const PdfDocument: React.FC<PdfDocumentProps> = ({
icon="expand"
variant="ghost"
size="small"
aria-label={formatMessage(messages.expand)}
onClick={() => expandCallback(true)}
/>
) : onClose ? (
Expand All @@ -91,6 +95,7 @@ export const PdfDocument: React.FC<PdfDocumentProps> = ({
icon="close"
variant="ghost"
size="small"
aria-label={formatMessage(messages.close)}
onClick={onClose}
/>
) : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const DocumentsOverview = () => {
<Box className={styles.checkboxWrap} marginRight={3}>
<Checkbox
name="checkbox-select-all"
aria-label={formatMessage(messages.selectAll)}
ariaLabel={formatMessage(messages.selectAll)}
checked={selectedLines.length > 0}
onChange={(e) => {
if (e.target.checked) {
Expand Down
20 changes: 20 additions & 0 deletions libs/portals/my-pages/documents/src/utils/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,24 @@ export const messages = defineMessages({
id: 'sp.documents:search-label',
defaultMessage: 'Leita',
},
zoomIn: {
id: 'sp.documents:zoom-in',
defaultMessage: 'Þysja að',
},
zoomOut: {
id: 'sp.documents:zoom-out',
defaultMessage: 'Þysja frá',
},
zoomLevel: {
id: 'sp.documents:zoom-level',
defaultMessage: 'Þysjuhlutfall',
},
expand: {
id: 'sp.documents:expand',
defaultMessage: 'Stækka',
},
close: {
id: 'sp.documents:close',
defaultMessage: 'Loka',
},
})
Loading