chore: Add missing labels to buttons without text and search inputs

This commit is contained in:
Tom Moor
2021-01-22 19:31:30 -08:00
parent 6a206de6cd
commit c9fdf48c33
19 changed files with 43 additions and 17 deletions

View File

@ -145,8 +145,8 @@ function IconPicker({ onOpen, icon, color, onChange }: Props) {
</Label> </Label>
<MenuButton {...menu}> <MenuButton {...menu}>
{(props) => ( {(props) => (
<Button {...props}> <Button aria-label={t("Show menu")} {...props}>
<Component role="button" color={color} size={30} /> <Component color={color} size={30} />
</Button> </Button>
)} )}
</MenuButton> </MenuButton>

View File

@ -1,6 +1,7 @@
// @flow // @flow
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { useTranslation } from "react-i18next";
import { Portal } from "react-portal"; import { Portal } from "react-portal";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import type { Location } from "react-router-dom"; import type { Location } from "react-router-dom";
@ -85,6 +86,7 @@ const useResize = ({ width, minWidth, maxWidth, setWidth }) => {
function Sidebar({ location, children }: Props) { function Sidebar({ location, children }: Props) {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const { ui } = useStores(); const { ui } = useStores();
const previousLocation = usePrevious(location); const previousLocation = usePrevious(location);
@ -157,7 +159,7 @@ function Sidebar({ location, children }: Props) {
onDoubleClick={handleReset} onDoubleClick={handleReset}
$isResizing={isResizing} $isResizing={isResizing}
> >
<ResizeHandle /> <ResizeHandle name={t("Resize sidebar")} />
</ResizeBorder> </ResizeBorder>
)} )}
</Container> </Container>

View File

@ -21,7 +21,7 @@ function CollapseToggle({ collapsed, ...rest }: Props) {
delay={500} delay={500}
placement="bottom" placement="bottom"
> >
<Button {...rest} aria-hidden> <Button {...rest} tabIndex="-1" aria-hidden>
{collapsed ? ( {collapsed ? (
<NextIcon color="currentColor" /> <NextIcon color="currentColor" />
) : ( ) : (

View File

@ -19,7 +19,7 @@ export default function BreadcrumbMenu({ path }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show path to document")} {...menu} />
<ContextMenu {...menu} aria-label={t("Path to document")}> <ContextMenu {...menu} aria-label={t("Path to document")}>
<Template <Template
{...menu} {...menu}

View File

@ -18,7 +18,7 @@ function CollectionGroupMemberMenu({ onMembers, onRemove }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("Group member options")}> <ContextMenu {...menu} aria-label={t("Group member options")}>
<Template <Template
{...menu} {...menu}

View File

@ -116,7 +116,7 @@ function CollectionMenu({
{label ? ( {label ? (
<MenuButton {...menu}>{label}</MenuButton> <MenuButton {...menu}>{label}</MenuButton>
) : ( ) : (
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
)} )}
<ContextMenu <ContextMenu
{...menu} {...menu}

View File

@ -38,7 +38,7 @@ function CollectionSortMenu({ collection, onOpen, onClose, ...rest }: Props) {
<> <>
<MenuButton {...menu}> <MenuButton {...menu}>
{(props) => ( {(props) => (
<NudeButton {...props}> <NudeButton aria-label={t("Show sort menu")} {...props}>
{alphabeticalSort ? <AlphabeticalSortIcon /> : <ManualSortIcon />} {alphabeticalSort ? <AlphabeticalSortIcon /> : <ManualSortIcon />}
</NudeButton> </NudeButton>
)} )}

View File

@ -140,7 +140,11 @@ function DocumentMenu({
{label ? ( {label ? (
<MenuButton {...menu}>{label}</MenuButton> <MenuButton {...menu}>{label}</MenuButton>
) : ( ) : (
<OverflowMenuButton className={className} {...menu} /> <OverflowMenuButton
className={className}
aria-label={t("Show menu")}
{...menu}
/>
)} )}
<ContextMenu <ContextMenu
{...menu} {...menu}

View File

@ -17,7 +17,7 @@ function GroupMemberMenu({ onRemove }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("Group member options")}> <ContextMenu {...menu} aria-label={t("Group member options")}>
<Template <Template
{...menu} {...menu}

View File

@ -41,7 +41,7 @@ function GroupMenu({ group, onMembers }: Props) {
> >
<GroupDelete group={group} onSubmit={() => setDeleteModalOpen(false)} /> <GroupDelete group={group} onSubmit={() => setDeleteModalOpen(false)} />
</Modal> </Modal>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("Group options")}> <ContextMenu {...menu} aria-label={t("Group options")}>
<Template <Template
{...menu} {...menu}

View File

@ -17,7 +17,7 @@ function MemberMenu({ onRemove }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("Member options")}> <ContextMenu {...menu} aria-label={t("Member options")}>
<Template <Template
{...menu} {...menu}

View File

@ -51,6 +51,7 @@ function RevisionMenu({ document, revision, className, iconColor }: Props) {
<OverflowMenuButton <OverflowMenuButton
className={className} className={className}
iconColor={iconColor} iconColor={iconColor}
aria-label={t("Show menu")}
{...menu} {...menu}
/> />
<ContextMenu {...menu} aria-label={t("Revision options")}> <ContextMenu {...menu} aria-label={t("Revision options")}>

View File

@ -49,7 +49,7 @@ function ShareMenu({ share }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("Share options")}> <ContextMenu {...menu} aria-label={t("Share options")}>
<CopyToClipboard text={share.url} onCopy={handleCopy}> <CopyToClipboard text={share.url} onCopy={handleCopy}>
<MenuItem {...menu}>{t("Copy link")}</MenuItem> <MenuItem {...menu}>{t("Copy link")}</MenuItem>

View File

@ -88,7 +88,7 @@ function UserMenu({ user }: Props) {
return ( return (
<> <>
<OverflowMenuButton {...menu} /> <OverflowMenuButton aria-label={t("Show menu")} {...menu} />
<ContextMenu {...menu} aria-label={t("User options")}> <ContextMenu {...menu} aria-label={t("User options")}>
<Template <Template
{...menu} {...menu}

View File

@ -145,6 +145,8 @@ class CollectionScene extends React.Component<Props> {
<InputSearch <InputSearch
source="collection" source="collection"
placeholder={`${t("Search in collection")}`} placeholder={`${t("Search in collection")}`}
label={`${t("Search in collection")}`}
labelHidden
collectionId={match.params.id} collectionId={match.params.id}
/> />
</Action> </Action>

View File

@ -64,7 +64,11 @@ function Dashboard() {
</Switch> </Switch>
<Actions align="center" justify="flex-end"> <Actions align="center" justify="flex-end">
<Action> <Action>
<InputSearch source="dashboard" /> <InputSearch
source="dashboard"
label={t("Search documents")}
labelHidden
/>
</Action> </Action>
<Action> <Action>
<NewDocumentMenu /> <NewDocumentMenu />

View File

@ -113,7 +113,11 @@ class Drafts extends React.Component<Props> {
<Actions align="center" justify="flex-end"> <Actions align="center" justify="flex-end">
<Action> <Action>
<InputSearch source="drafts" /> <InputSearch
source="drafts"
label={t("Search documents")}
labelHidden
/>
</Action> </Action>
<Action> <Action>
<NewDocumentMenu /> <NewDocumentMenu />

View File

@ -48,7 +48,11 @@ function Starred(props: Props) {
<Actions align="center" justify="flex-end"> <Actions align="center" justify="flex-end">
<Action> <Action>
<InputSearch source="starred" /> <InputSearch
source="starred"
label={t("Search documents")}
labelHidden
/>
</Action> </Action>
<Action> <Action>
<NewDocumentMenu /> <NewDocumentMenu />

View File

@ -76,6 +76,7 @@
"Warning": "Warning", "Warning": "Warning",
"Warning notice": "Warning notice", "Warning notice": "Warning notice",
"Icon": "Icon", "Icon": "Icon",
"Show menu": "Show menu",
"Choose icon": "Choose icon", "Choose icon": "Choose icon",
"Loading": "Loading", "Loading": "Loading",
"Search": "Search", "Search": "Search",
@ -108,6 +109,7 @@
"Export Data": "Export Data", "Export Data": "Export Data",
"Integrations": "Integrations", "Integrations": "Integrations",
"Installation": "Installation", "Installation": "Installation",
"Resize sidebar": "Resize sidebar",
"Appearance": "Appearance", "Appearance": "Appearance",
"System": "System", "System": "System",
"Light": "Light", "Light": "Light",
@ -117,6 +119,7 @@
"Send us feedback": "Send us feedback", "Send us feedback": "Send us feedback",
"Report a bug": "Report a bug", "Report a bug": "Report a bug",
"Log out": "Log out", "Log out": "Log out",
"Show path to document": "Show path to document",
"Path to document": "Path to document", "Path to document": "Path to document",
"Group member options": "Group member options", "Group member options": "Group member options",
"Members": "Members", "Members": "Members",
@ -132,6 +135,7 @@
"Edit collection": "Edit collection", "Edit collection": "Edit collection",
"Delete collection": "Delete collection", "Delete collection": "Delete collection",
"Export collection": "Export collection", "Export collection": "Export collection",
"Show sort menu": "Show sort menu",
"Sort in sidebar": "Sort in sidebar", "Sort in sidebar": "Sort in sidebar",
"Alphabetical sort": "Alphabetical sort", "Alphabetical sort": "Alphabetical sort",
"Manual sort": "Manual sort", "Manual sort": "Manual sort",
@ -235,6 +239,7 @@
"Create": "Create", "Create": "Create",
"Recently viewed": "Recently viewed", "Recently viewed": "Recently viewed",
"Created by me": "Created by me", "Created by me": "Created by me",
"Search documents": "Search documents",
"Hide contents": "Hide contents", "Hide contents": "Hide contents",
"Show contents": "Show contents", "Show contents": "Show contents",
"Archived": "Archived", "Archived": "Archived",