Primer Behaviors
Shared behaviors for JavaScript components
Documentation
Installation
npm install @primer/behaviorsor
yarn add @primer/behaviorsShared behaviors for JavaScript components
Shared behaviors for JavaScript components
npm install @primer/behaviorsor
yarn add @primer/behaviorsf539ae5 Thanks @iansan5653! - Fix cursor position checks to exclude select elements43f432a Thanks @iansan5653! - Expose isEditableElement util5cd0b90 Thanks @iansan5653! - Respect contenteditable elements when checking for editability in focus-zone behaviord88c043 Thanks @TylerJDev! - Prevent duplicate sentinels from being added if some already exist in the container of the focus trap.62dc90a Thanks @camertron! - Ensure focusZone() clears all potential active descendants4b729b0 Thanks @TylerJDev! - Adds mutation observer to focus-trap to ensure sentinel elements are always in the correct positionfd1419a Thanks @joshblack! - Remove optionalDependencies from npm package67215a5 Thanks @joshblack! - Update the output of the package to correctly map "import" conditions to ESM5d7e0b1 Thanks @TylerJDev! - Adjusts mutation observer to now track hidden and disabled attributes being applied or removed.3a3cd61 Thanks @JelloBagel! - Fix bug found when removing nodes in a focus zone with strict mode enabledcaf30c4 Thanks @pksjce! - When zoomed in, an overlay floating element should anchor itself properly instead of getting the top part cut off in the processcb98837 Thanks @JelloBagel! - Add support for contenteditable to iterateFocusableElements7a7faa9 Thanks @JelloBagel! - Add IterateFocusableElements options to focusZone2042afc Thanks @EnixCoda! - Update anchored-position.ts to support handling elements outside of document.body in getClippingRectbddd6c5 Thanks @keithamus! - Special case anchored-position calls on top-layer elementseca845b Thanks @colebemis! - FocusZone: If custom focusInStrategy is defined, use it to initialize tabIndexes5e74867 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.b14b5ac Thanks @colebemis! - focusZone: Add Backspace key to list of FocusKeysafaf380 Thanks @colebemis! - focusZone: Add preventScroll optione5aaf68 Thanks @siddharthkp! - Anchored position: Add check for boundary collision on left side62e5459 Thanks @siddharthkp! - Anchored Position: Add alternative alignments to flip to if there isn't enough spacea96d60f Thanks @dgreif! - Add import conditional export type to the package for better NodeJS ESM compatibility1aa3027 Thanks @owenniblock! - Update focusTrap to use new methodology after accessibility discussions