Skip to content

Commit

Permalink
fix: Remove screen reader specific navigation grid (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
avinashbot authored Jul 2, 2024
1 parent f76c386 commit bd7f894
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 237 deletions.
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 120
"printWidth": 120,
"trailingComma": "all"
}
10 changes: 0 additions & 10 deletions src/__tests__/__snapshots__/documenter.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ Live announcements:
* \`liveAnnouncementDndDiscarded(BoardProps.DndOperationType): string\` - the function to create a live announcement string to indicate commit of DnD ("reorder", "resize" or "insert").
* \`liveAnnouncementDndCommitted(BoardProps.DndOperationType): string\` - the function to create a live announcement string to indicate discard of DnD ("reorder", "resize" or "insert").
* \`liveAnnouncementItemRemoved(BoardProps.OperationStateRemove<D>): string\` - the function to create a live announcement string to indicate when item is removed.
Navigation labels:
* \`navigationAriaLabel\` (string) - the ARIA label for the accessible board navigation element.
* \`navigationAriaDescription\` (string, optional) - the ARIA description for the accessible board navigation element.
* \`navigationItemAriaLabel(null | BoardProps.Item<D>): string\` - the function to create the ARIA label for a navigation board item or an empty slot.
",
"inlineType": {
"name": "BoardProps.I18nStrings",
Expand Down Expand Up @@ -258,11 +253,6 @@ exports[`definition for items-palette matches the snapshot > items-palette 1`] =
Live announcements:
* \`liveAnnouncementDndStarted\` (string) - live announcement string to indicate start of DnD.
* \`liveAnnouncementDndDiscarded\` (string) - live announcement string to indicate discard of DnD.
Navigation labels:
* \`navigationAriaLabel\` (string) - the ARIA label for the accessible board navigation element.
* \`navigationAriaDescription\` (string, optional) - the ARIA description for the accessible board navigation element.
* \`navigationItemAriaLabel(null | BoardProps.Item<D>): string\` - the function to create the ARIA label for a navigation board item.
",
"inlineType": {
"name": "ItemsPaletteProps.I18nStrings",
Expand Down
9 changes: 4 additions & 5 deletions src/board/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ export interface BoardProps<D = DataFallbackType> {
* * `liveAnnouncementDndDiscarded(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate commit of DnD ("reorder", "resize" or "insert").
* * `liveAnnouncementDndCommitted(BoardProps.DndOperationType): string` - the function to create a live announcement string to indicate discard of DnD ("reorder", "resize" or "insert").
* * `liveAnnouncementItemRemoved(BoardProps.OperationStateRemove<D>): string` - the function to create a live announcement string to indicate when item is removed.
*
* Navigation labels:
* * `navigationAriaLabel` (string) - the ARIA label for the accessible board navigation element.
* * `navigationAriaDescription` (string, optional) - the ARIA description for the accessible board navigation element.
* * `navigationItemAriaLabel(null | BoardProps.Item<D>): string` - the function to create the ARIA label for a navigation board item or an empty slot.
*/
i18nStrings: BoardProps.I18nStrings<D>;

Expand Down Expand Up @@ -113,8 +108,12 @@ export namespace BoardProps {
liveAnnouncementDndCommitted: (operationType: DndOperationType) => string;
liveAnnouncementDndDiscarded: (operationType: DndOperationType) => string;
liveAnnouncementItemRemoved: (operation: ItemRemovedState<D>) => string;

/** @deprecated Has no effect. */
navigationAriaLabel: string;
/** @deprecated Has no effect. */
navigationAriaDescription?: string;
/** @deprecated Has no effect. */
navigationItemAriaLabel: (item: null | BoardProps.Item<D>) => string;
}

Expand Down
14 changes: 0 additions & 14 deletions src/board/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Grid from "../internal/grid";
import { BoardItemDefinition, BoardItemDefinitionBase, Direction, ItemId, Rect } from "../internal/interfaces";
import { ItemContainer, ItemContainerRef } from "../internal/item-container";
import LiveRegion from "../internal/live-region";
import { ScreenReaderGridNavigation } from "../internal/screenreader-grid-navigation";
import {
createPlaceholdersLayout,
getDefaultColumnSpan,
Expand Down Expand Up @@ -206,10 +205,6 @@ export function InternalBoard<D>({
dispatch({ type: "init-remove", items, itemsLayout, removedItem });
};

function focusItem(itemId: ItemId) {
itemContainerRef.current[itemId].focusDragHandle();
}

function onItemMove(direction: Direction) {
if (transition) {
dispatch({ type: "update-with-keyboard", direction });
Expand All @@ -223,15 +218,6 @@ export function InternalBoard<D>({

return (
<div ref={__internalRootRef} {...getDataAttributes(rest)}>
<ScreenReaderGridNavigation
items={items}
itemsLayout={itemsLayout}
ariaLabel={i18nStrings.navigationAriaLabel}
ariaDescription={i18nStrings.navigationAriaDescription}
itemAriaLabel={i18nStrings.navigationItemAriaLabel}
onActivateItem={focusItem}
/>

<div ref={containerRef} className={clsx(styles.root, { [styles.empty]: rows === 0 })}>
{rows > 0 ? (
<Grid
Expand Down

This file was deleted.

106 changes: 0 additions & 106 deletions src/internal/screenreader-grid-navigation/index.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/internal/screenreader-grid-navigation/styles.scss

This file was deleted.

8 changes: 3 additions & 5 deletions src/items-palette/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ export interface ItemsPaletteProps<D = DataFallbackType> {
* Live announcements:
* * `liveAnnouncementDndStarted` (string) - live announcement string to indicate start of DnD.
* * `liveAnnouncementDndDiscarded` (string) - live announcement string to indicate discard of DnD.
*
* Navigation labels:
* * `navigationAriaLabel` (string) - the ARIA label for the accessible board navigation element.
* * `navigationAriaDescription` (string, optional) - the ARIA description for the accessible board navigation element.
* * `navigationItemAriaLabel(null | BoardProps.Item<D>): string` - the function to create the ARIA label for a navigation board item.
*/
i18nStrings: ItemsPaletteProps.I18nStrings<D>;
}
Expand All @@ -57,8 +52,11 @@ export namespace ItemsPaletteProps {
export interface I18nStrings<D> {
liveAnnouncementDndStarted: string;
liveAnnouncementDndDiscarded: string;
/** @deprecated Has no effect. */
navigationAriaLabel: string;
/** @deprecated Has no effect. */
navigationAriaDescription?: string;
/** @deprecated Has no effect. */
navigationItemAriaLabel: (item: ItemsPaletteProps.Item<D>) => string;
}
}
20 changes: 0 additions & 20 deletions src/items-palette/internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useDragSubscription } from "../internal/dnd-controller/controller";
import { ItemId } from "../internal/interfaces";
import { ItemContainer, ItemContainerRef } from "../internal/item-container";
import LiveRegion from "../internal/live-region";
import { ScreenReaderGridNavigation } from "../internal/screenreader-grid-navigation";
import { ItemsPaletteProps } from "./interfaces";
import styles from "./styles.css.js";

Expand All @@ -27,10 +26,6 @@ export function InternalItemsPalette<D>({

const isRtl = () => getIsRtl(paletteRef.current);

function focusItem(itemId: ItemId) {
itemContainerRef.current[itemId].focusDragHandle();
}

useDragSubscription("start", ({ draggableItem: { id } }) => {
setDropState({ id });

Expand Down Expand Up @@ -71,23 +66,8 @@ export function InternalItemsPalette<D>({
}
});

const itemsLayout = {
items: items.map((it, index) => ({ id: it.id, x: 0, y: index, width: 1, height: 1 })),
columns: 1,
rows: items.length,
};

return (
<div ref={__internalRootRef} {...getDataAttributes(rest)}>
<ScreenReaderGridNavigation
items={items}
itemsLayout={itemsLayout}
ariaLabel={i18nStrings.navigationAriaLabel}
ariaDescription={i18nStrings.navigationAriaDescription}
itemAriaLabel={(item) => i18nStrings.navigationItemAriaLabel(item!)}
onActivateItem={focusItem}
/>

<div ref={paletteRef} className={styles.root}>
<SpaceBetween size="l">
{items.map((item) => (
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"types": [],
"lib": ["es2019", "dom", "dom.iterable"],
"module": "ESNext",
"moduleResolution": "nodenext",
"moduleResolution": "Node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
Expand Down

0 comments on commit bd7f894

Please sign in to comment.