@podoba/react 0.0.54 → 0.0.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podoba/react",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "description": "podoba React components — React Aria Components + Tailwind primitives + layout, built with uic.",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "typecheck": "tsc --build"
29
29
  },
30
30
  "dependencies": {
31
- "@podoba/tokens": "^0.0.54",
32
- "@podoba/tailwind": "^0.0.54",
31
+ "@podoba/tokens": "^0.0.55",
32
+ "@podoba/tailwind": "^0.0.55",
33
33
  "react-aria-components": "1.20.0",
34
34
  "class-variance-authority": "0.7.1",
35
35
  "clsx": "2.1.1",
@@ -1,16 +1,18 @@
1
- import { useEffect, useRef } from 'react'
1
+ import { useLayoutEffect, useRef } from 'react'
2
2
 
3
3
  /** Wait until dialog focus scopes and slotted controls have mounted. */
4
4
  export function useFieldAutoFocus(autoFocus: boolean | undefined) {
5
5
  const ref = useRef<HTMLDivElement>(null)
6
- useEffect(() => {
6
+ useLayoutEffect(() => {
7
7
  if (!autoFocus) return
8
+ const previousFocus = ref.current?.ownerDocument.activeElement
8
9
  const frame = requestAnimationFrame(() => {
9
10
  const control = ref.current?.querySelector<HTMLInputElement | HTMLTextAreaElement>('input, textarea')
10
11
  if (!control || control.disabled) return
11
12
  const active = control.ownerDocument.activeElement
12
13
  // Do not steal focus if the user or another field has already claimed it.
13
14
  if (
15
+ active === previousFocus ||
14
16
  active === control.ownerDocument.body ||
15
17
  active === control.closest('[role="dialog"], [role="alertdialog"]')
16
18
  ) {
@@ -356,7 +356,13 @@ export function WizardFormDialog({
356
356
  </DisplayHeading>
357
357
  </Container>
358
358
  </header>
359
- <ScrollBody style={{ scrollbarGutter: 'stable' }}>
359
+ <ScrollBody
360
+ role="region"
361
+ tabIndex={0}
362
+ aria-label={ariaLabel}
363
+ aria-labelledby={ariaLabel ? undefined : titleId}
364
+ style={{ scrollbarGutter: 'stable' }}
365
+ >
360
366
  <Container className="max-w-384 px-5 min-[901px]:px-6">
361
367
  <Body className="gap-8">{children}</Body>
362
368
  </Container>