@octanejs/dnd-kit-accessibility 0.0.0-stage → 0.0.0
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/LICENSE +21 -0
- package/LICENSE.upstream +21 -0
- package/README.md +42 -2
- package/UPSTREAM.md +55 -0
- package/package.json +49 -3
- package/src/components/HiddenText/HiddenText.tsx +19 -0
- package/src/components/HiddenText/index.ts +1 -0
- package/src/components/LiveRegion/LiveRegion.tsx +32 -0
- package/src/components/LiveRegion/index.ts +1 -0
- package/src/components/index.ts +2 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAnnouncement.ts +12 -0
- package/src/index.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dominic Gannaway
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE.upstream
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021, Claudéric Demers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@octanejs/dnd-kit-accessibility`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Screen-reader primitives for the legacy dnd kit API on Octane, ported from
|
|
4
|
+
`@dnd-kit/accessibility` 3.1.1: `HiddenText`, `LiveRegion`, and
|
|
5
|
+
`useAnnouncement`. `@octanejs/dnd-kit-core` renders them for drag announcements.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @octanejs/dnd-kit-accessibility octane
|
|
11
|
+
pnpm add @octanejs/dnd-kit-accessibility octane
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Replace imports from `@dnd-kit/accessibility` with `@octanejs/dnd-kit-accessibility`;
|
|
15
|
+
[`@octanejs/codemod`](../codemod) rewrites them for you.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```tsrx
|
|
20
|
+
import { LiveRegion, useAnnouncement } from '@octanejs/dnd-kit-accessibility';
|
|
21
|
+
|
|
22
|
+
export function Status() @{
|
|
23
|
+
const { announce, announcement } = useAnnouncement();
|
|
24
|
+
<>
|
|
25
|
+
<button onClick={() => announce('Saved.')}>Save</button>
|
|
26
|
+
<LiveRegion id="status" announcement={announcement} />
|
|
27
|
+
</>
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## About this port
|
|
32
|
+
|
|
33
|
+
This package is part of Octane's port of the legacy dnd kit API, the
|
|
34
|
+
`@dnd-kit/core` 6.x family: `@octanejs/dnd-kit-core`, `@octanejs/dnd-kit-sortable`,
|
|
35
|
+
`@octanejs/dnd-kit-modifiers`, `@octanejs/dnd-kit-utilities`, and
|
|
36
|
+
`@octanejs/dnd-kit-accessibility`, one per upstream package. For the modern
|
|
37
|
+
`@dnd-kit/react` API, use [`@octanejs/dnd-kit`](../dnd-kit).
|
|
38
|
+
|
|
39
|
+
Parity is `recorded-unverified`. Upstream's own unit tests are placeholders, so
|
|
40
|
+
each package runs them pristine and adapted, and a repo-authored differential test
|
|
41
|
+
runs the same fixtures against the published React package and compares the DOM
|
|
42
|
+
after every drag step. See [`UPSTREAM.md`](./UPSTREAM.md) for the pin and the
|
|
43
|
+
evidence.
|
package/UPSTREAM.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `@octanejs/dnd-kit-accessibility` upstream ledger
|
|
2
|
+
|
|
3
|
+
`@octanejs/dnd-kit-accessibility` ports `@dnd-kit/accessibility@3.1.1` from
|
|
4
|
+
`https://github.com/clauderic/dnd-kit.git`, the legacy dnd kit API.
|
|
5
|
+
|
|
6
|
+
## Pin
|
|
7
|
+
|
|
8
|
+
- Package: `@dnd-kit/accessibility@3.1.1`, the latest release.
|
|
9
|
+
- Source commit: `e9215e820798459ae036896fce7fd9a6fe855772`, the `@dnd-kit/core@6.3.1` release tag. It holds all
|
|
10
|
+
five legacy packages at their latest releases. Their trees there are
|
|
11
|
+
byte-identical to their own release tags; this package's tag is
|
|
12
|
+
`@dnd-kit/accessibility@3.1.1` at `2ed036393f80066423545acfe1b394ca0822c1fe`.
|
|
13
|
+
- npm integrity: `sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==`
|
|
14
|
+
- npm tarball SHA-256: `5c4e4168454bc38e0ae6d95b00931bad8a4eda487760e36460217387a0b31450`
|
|
15
|
+
- License: MIT. `LICENSE.upstream` is the upstream package's license, byte for byte.
|
|
16
|
+
- React oracle: `react@19.2.7` and `react-dom@19.2.7` from the default catalog.
|
|
17
|
+
|
|
18
|
+
The legacy packages were published without a `gitHead` or npm provenance, so the
|
|
19
|
+
repository's preflight cannot tie the npm artifact to a commit on its own. The
|
|
20
|
+
source is pinned to the release tag instead, and the parity status stays
|
|
21
|
+
`recorded-unverified`.
|
|
22
|
+
|
|
23
|
+
`upstream/` holds the pinned package directory byte for byte. Each file
|
|
24
|
+
is checked against its git blob SHA in `audit/upstream.lock.json`:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pnpm react-port:materialize run --check --package-dir packages/dnd-kit-accessibility
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Source boundary
|
|
31
|
+
|
|
32
|
+
`src/` mirrors `upstream/src/` file for file, formatted with the repository's
|
|
33
|
+
Prettier settings, with `react`/`react-dom` imports pointed at `octane` and
|
|
34
|
+
`@dnd-kit/*` imports pointed at the `@octanejs/dnd-kit-*` packages. Files that
|
|
35
|
+
change beyond that:
|
|
36
|
+
|
|
37
|
+
- `components/HiddenText/HiddenText.tsx`, `components/LiveRegion/LiveRegion.tsx`: the `React.CSSProperties` type comes from `octane`, and the files carry the Octane JSX pragma.
|
|
38
|
+
|
|
39
|
+
## Public surface
|
|
40
|
+
|
|
41
|
+
Every runtime export of `@dnd-kit/accessibility@3.1.1` is ported under the same name: `HiddenText`, `LiveRegion`, and `useAnnouncement`.
|
|
42
|
+
`tests/exports.test.ts` compares the export names and value kinds with the published
|
|
43
|
+
package, and `typetests/public-api.test-d.ts` checks the public types.
|
|
44
|
+
|
|
45
|
+
## Tests
|
|
46
|
+
|
|
47
|
+
| Upstream | Disposition |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `test/accessibility.test.tsx (1 placeholder case)` | Runs unchanged against the pinned source and React (`dnd-kit-accessibility-pristine`), and regenerated from the lock against the port (`dnd-kit-accessibility-upstream`). |
|
|
50
|
+
| Repository Cypress specs (`cypress/integration/draggable_spec.ts`, `sortable_spec.ts`) | Not ported. They drive the Storybook stories outside the package boundary. The differential below covers the same pointer and keyboard drags against the published package. |
|
|
51
|
+
|
|
52
|
+
Because the upstream unit tests are placeholders, the behavioral contract is the
|
|
53
|
+
repo-authored differential: `tests/differential/parity.test.ts` (both live-region politeness levels, the hidden instructions, and announce/ignore/clear). `audit/react-parity.json` registers all three
|
|
54
|
+
lanes; `node scripts/react-parity/dnd-kit-legacy-manifest.mjs` regenerates it and
|
|
55
|
+
the runtime inventories.
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/dnd-kit-accessibility",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.22.2"
|
|
9
|
+
},
|
|
10
|
+
"description": "dnd kit accessibility primitives for the octane renderer — a port of the legacy @dnd-kit/accessibility 3.1.1 HiddenText, LiveRegion, and useAnnouncement.",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Dominic Gannaway",
|
|
13
|
+
"email": "dg@domgan.com"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/octanejs/octane.git",
|
|
21
|
+
"directory": "packages/dnd-kit-accessibility"
|
|
22
|
+
},
|
|
23
|
+
"main": "src/index.ts",
|
|
24
|
+
"module": "src/index.ts",
|
|
25
|
+
"types": "src/index.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"README.md",
|
|
29
|
+
"UPSTREAM.md",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"LICENSE.upstream"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./src/index.ts"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"octane": "^0.16.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@dnd-kit/accessibility": "3.1.1",
|
|
41
|
+
"@tsrx/react": "^0.4.5",
|
|
42
|
+
"esbuild": "^0.28.1",
|
|
43
|
+
"octane": "0.16.3",
|
|
44
|
+
"react": "19.2.7",
|
|
45
|
+
"react-dom": "19.2.7",
|
|
46
|
+
"vitest": "^4.1.10"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "vitest run --root ../.. --project dnd-kit-accessibility",
|
|
50
|
+
"typecheck": "octane-tsc -p tsconfig.json"
|
|
51
|
+
}
|
|
6
52
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
import type { CSSProperties } from 'octane';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
id: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const hiddenStyles: CSSProperties = {
|
|
10
|
+
display: 'none',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function HiddenText({ id, value }: Props) {
|
|
14
|
+
return (
|
|
15
|
+
<div id={id} style={hiddenStyles}>
|
|
16
|
+
{value}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HiddenText } from './HiddenText';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** @jsxImportSource octane */
|
|
2
|
+
import type { CSSProperties } from 'octane';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
id: string;
|
|
6
|
+
announcement: string;
|
|
7
|
+
ariaLiveType?: 'polite' | 'assertive' | 'off';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function LiveRegion({ id, announcement, ariaLiveType = 'assertive' }: Props) {
|
|
11
|
+
// Hide element visually but keep it readable by screen readers
|
|
12
|
+
const visuallyHidden: CSSProperties = {
|
|
13
|
+
position: 'fixed',
|
|
14
|
+
top: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
width: 1,
|
|
17
|
+
height: 1,
|
|
18
|
+
margin: -1,
|
|
19
|
+
border: 0,
|
|
20
|
+
padding: 0,
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
clip: 'rect(0 0 0 0)',
|
|
23
|
+
clipPath: 'inset(100%)',
|
|
24
|
+
whiteSpace: 'nowrap',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div id={id} style={visuallyHidden} role="status" aria-live={ariaLiveType} aria-atomic>
|
|
29
|
+
{announcement}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LiveRegion } from './LiveRegion';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useAnnouncement } from './useAnnouncement';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCallback, useState } from 'octane';
|
|
2
|
+
|
|
3
|
+
export function useAnnouncement() {
|
|
4
|
+
const [announcement, setAnnouncement] = useState('');
|
|
5
|
+
const announce = useCallback((value: string | undefined) => {
|
|
6
|
+
if (value != null) {
|
|
7
|
+
setAnnouncement(value);
|
|
8
|
+
}
|
|
9
|
+
}, []);
|
|
10
|
+
|
|
11
|
+
return { announce, announcement } as const;
|
|
12
|
+
}
|
package/src/index.ts
ADDED