Skip to content
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

fix(core): add missing aria-labels to navbar icons #5810

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
4 changes: 3 additions & 1 deletion packages/sanity/src/core/components/StatusButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {useTheme} from '@sanity/ui'
import {type ForwardedRef, forwardRef, type HTMLProps, type ReactNode, useMemo} from 'react'
import {useTranslation} from 'react-i18next'
import styled from 'styled-components'

import {Button, type ButtonProps} from '../../ui-components'
Expand Down Expand Up @@ -38,6 +39,7 @@ export const StatusButton = forwardRef(function StatusButton(
) {
const {disabled: disabledProp, icon, label, mode = 'bleed', text, tone, ...restProps} = props
const theme = useTheme()
const {t} = useTranslation()
const toneColor = tone && theme.sanity.color.solid[tone]
const dotStyle = useMemo(() => ({backgroundColor: toneColor?.enabled.bg}), [toneColor])
const disabled = Boolean(disabledProp)
Expand All @@ -46,7 +48,7 @@ export const StatusButton = forwardRef(function StatusButton(
<StyledButton
data-ui="StatusButton"
{...restProps}
aria-label={label}
aria-label={label || t('status-button.aria-label')}
disabled={disabled}
mode={mode}
ref={ref}
Expand Down
8 changes: 6 additions & 2 deletions packages/sanity/src/core/i18n/bundles/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,14 +1055,16 @@ export const studioLocaleStrings = defineLocalesResources('studio', {

/** Label for action to manage members of the current studio project */
'presence.action.manage-members': 'Manage members',
/** Accessibility label for Avatar Stack */
'presence.aria-label': 'Who is here',
/** Accessibility label for presence menu button */
'presence.aria-label': 'Global presence',
/** Message description for when no one else is currently present */
'presence.no-one-else-description': 'Invite people to the project to see their online status.',
/** Message title for when no one else is currently present */
'presence.no-one-else-title': 'No one else is here',
/** Message for when a user is not in a document (displayed in the global presence menu) */
'presence.not-in-a-document': 'Not in a document',
/** Tooltip content text for presence menu button */
'presence.tooltip-content': 'Who is here',

/** Fallback title shown when a preview does not provide a title */
'preview.default.title-fallback': 'Untitled',
Expand Down Expand Up @@ -1524,6 +1526,8 @@ export const studioLocaleStrings = defineLocalesResources('studio', {
'search.recent-searches-label': 'Recent searches',
/** Accessibility label for the search results section, shown when the user has typed valid terms */
'search.search-results-aria-label': 'Search results',
/** Accessibility label for the navbar status button */
'status-button.aria-label': 'Configuration status',

/** Description for error when the timeline for the given document can't be loaded */
'timeline.error.load-document-changes-description':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export function PresenceMenu() {
mode="bleed"
tone={hasPresence ? 'positive' : undefined}
tooltipProps={{
// @todo: rename, as its no longer an aria-label
content: t('presence.aria-label'),
content: t('presence.tooltip-content'),
}}
/>
)
Expand All @@ -74,6 +73,7 @@ export function PresenceMenu() {
return (
<MenuButton
button={button}
aria-label={t('presence.aria-label')}
id="global-presence-menu"
menu={
<StyledMenu>
Expand Down
Loading