Skip to content

Latest commit

 

History

History
240 lines (130 loc) · 13.1 KB

File metadata and controls

240 lines (130 loc) · 13.1 KB

@primer/behaviors

1.10.3

Patch Changes

  • #739 705cc19 Thanks @TylerJDev! - Focus-trap: Add option to prevent scrolling when programmatically setting focus.

1.10.2

Patch Changes

  • #681 09af9ad Thanks @francinelucca! - fix(getAnchoredPosition): add better support for floatingElements inside dialogs through new "displayInViewport" setting

1.10.1

Patch Changes

  • #685 de1a034 Thanks @copilot-swe-agent! - Fix IndexedSet stack overflow and optimize performance

    Fixes:

    • Fix RangeError: Maximum call stack size exceeded when inserting large numbers of elements (50k+) in focus zones
    • Changed insertAt API from rest parameters to array parameter to avoid call stack issues

    Performance improvements:

    • Optimize indexOf() from O(n) to O(1) using a Map for index lookups
    • Optimize delete() from O(2n) to O(n) by using the index map
    • Add fast paths for common insertion patterns (append to end, prepend to start)

    Note: This is a minor API change - insertAt(index, ...elements) is now insertAt(index, elements). Callers should pass an array instead of spreading arguments.

1.10.0

Minor Changes

  • #668 15b49ab Thanks @TylerJDev! - Focus-zone: Reinitialize focus zone when new items are added and focusPrependedElements is true

1.9.2

Patch Changes

  • #661 419bcf0 Thanks @copilot-swe-agent! - Optimize getAnchoredPosition by reducing getComputedStyle calls
    • Combine DOM traversals for positioned parent and clipping node lookups into a single pass
    • Cache computed styles during traversal to avoid redundant getComputedStyle calls
    • Reduce calls from 2n + 2 to n for DOM trees of depth n (57% reduction for typical cases)
    • Improve performance for anchored positioning with deep DOM trees

1.9.1

Patch Changes

  • #665 7fa6e9a Thanks @kelsey-myers! - [Focus Zone] Fix edge-case where prepended element is not focused when elements are reordered

  • #657 457a1fb Thanks @mattcosta7! - Optimize DOM operations for better web vitals (INP, CLS, FID)

    • Batch reflow-causing reads in isFocusable() to minimize layout thrashing
    • Use Set for O(1) tag lookups instead of Array.includes()
    • Optimize getClippingRect() and getPositionedParent() with early exits
    • Batch MutationObserver DOM operations (read phase, then write phase)
    • Add sr-only inline styles to focus-trap sentinels to prevent CLS
    • Use :scope selector for faster direct-child sentinel lookup
    • Add IndexedSet for O(1) membership checks in focus zone hot paths

1.9.0

Minor Changes

  • #648 0cd03c3 Thanks @TylerJDev! - FocusZone: Introduce a new focusInStrategy option, "initial," to allow disabling the default behavior of focusing on the first item when the focus zone becomes active.

  • #641 cd90185 Thanks @TylerJDev! - FocusZone: Add setting ignoreHoverEvents which provides a configurable setting to disable selection on mouse hover

1.8.4

Patch Changes

1.8.3

Patch Changes

1.8.2

Patch Changes

  • #594 5cd0b90 Thanks @iansan5653! - Respect contenteditable elements when checking for editability in focus-zone behavior

1.8.1

Patch Changes

  • #473 d88c043 Thanks @TylerJDev! - Prevent duplicate sentinels from being added if some already exist in the container of the focus trap.

1.8.0

Minor Changes

1.7.2

Patch Changes

  • #429 4b729b0 Thanks @TylerJDev! - Adds mutation observer to focus-trap to ensure sentinel elements are always in the correct position

1.7.1

Patch Changes

1.7.0

Minor Changes

  • #400 67215a5 Thanks @joshblack! - Update the output of the package to correctly map "import" conditions to ESM

1.6.0

Minor Changes

  • #263 5d7e0b1 Thanks @TylerJDev! - Adjusts mutation observer to now track hidden and disabled attributes being applied or removed.

Patch Changes

  • #399 3a3cd61 Thanks @JelloBagel! - Fix bug found when removing nodes in a focus zone with strict mode enabled

1.5.1

Patch Changes

  • #245 caf30c4 Thanks @pksjce! - When zoomed in, an overlay floating element should anchor itself properly instead of getting the top part cut off in the process

1.5.0

Minor Changes

1.4.0

Minor Changes

1.3.6

Patch Changes

  • #208 2042afc Thanks @EnixCoda! - Update anchored-position.ts to support handling elements outside of document.body in getClippingRect

1.3.5

Patch Changes

1.3.4

Patch Changes

1.3.3

Patch Changes

  • #180 eca845b Thanks @colebemis! - FocusZone: If custom focusInStrategy is defined, use it to initialize tabIndexes

1.3.2

Patch Changes

  • #176 5e74867 Thanks @jbrown1618! - Use a binary search to find the insertion index for new elements managed by the focus zone. For a use case with 1000 elements managed by the focus zone, added one at a time (by react), this takes us from 500,000 calls to compareDocumentPosition over 1000ms to 8,000 calls over 16ms.

1.3.1

Patch Changes

1.3.0

Minor Changes

1.2.0

Minor Changes

1.1.3

Patch Changes

1.1.2

Patch Changes

  • #78 62e5459 Thanks @siddharthkp! - Anchored Position: Add alternative alignments to flip to if there isn't enough space

1.1.1

Patch Changes

  • #73 a96d60f Thanks @dgreif! - Add import conditional export type to the package for better NodeJS ESM compatibility

1.1.0

Minor Changes

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes