@primer/behaviors 1.3.2 → 1.3.3-rc.be41306

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/CHANGELOG.md ADDED
@@ -0,0 +1,78 @@
1
+ # @primer/behaviors
2
+
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180](https://github.com/primer/behaviors/pull/180) [`eca845b`](https://github.com/primer/behaviors/commit/eca845b9dbcd49383766ee55dfdcfa4fafbda4a6) Thanks [@colebemis](https://github.com/colebemis)! - FocusZone: If custom `focusInStrategy` is defined, use it to initialize tabIndexes
8
+
9
+ ## 1.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#176](https://github.com/primer/behaviors/pull/176) [`5e74867`](https://github.com/primer/behaviors/commit/5e7486702074bbb89e6a7a96a4b0db71d763c74c) Thanks [@jbrown1618](https://github.com/jbrown1618)! - Use a binary search to find the insertion index for new elements managed by the focus zone.
14
+ For a use case with 1000 elements managed by the focus zone, added one at a time (by react),
15
+ this takes us from 500,000 calls to `compareDocumentPosition` over 1000ms to 8,000 calls
16
+ over 16ms.
17
+
18
+ ## 1.3.1
19
+
20
+ ### Patch Changes
21
+
22
+ - [#155](https://github.com/primer/behaviors/pull/155) [`b14b5ac`](https://github.com/primer/behaviors/commit/b14b5ac5dc2ef9957e4b585e27acf7d5566edd5a) Thanks [@colebemis](https://github.com/colebemis)! - focusZone: Add Backspace key to list of FocusKeys
23
+
24
+ ## 1.3.0
25
+
26
+ ### Minor Changes
27
+
28
+ - [#152](https://github.com/primer/behaviors/pull/152) [`afaf380`](https://github.com/primer/behaviors/commit/afaf380893cb858e6c85515bb490866d76d3d8b7) Thanks [@colebemis](https://github.com/colebemis)! - focusZone: Add `preventScroll` option
29
+
30
+ ## 1.2.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [#134](https://github.com/primer/behaviors/pull/134) [`cc5bf8e`](https://github.com/primer/behaviors/commit/cc5bf8e8404594bc6b3ff1493f253b171bfb03c0) Thanks [@jonrohan](https://github.com/jonrohan)! - Add Dimensions behavior
35
+
36
+ ## 1.1.3
37
+
38
+ ### Patch Changes
39
+
40
+ - [#93](https://github.com/primer/behaviors/pull/93) [`e5aaf68`](https://github.com/primer/behaviors/commit/e5aaf688b084bf6e425c6bdb0963aa50aacf8fa4) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Anchored position: Add check for boundary collision on left side
41
+
42
+ ## 1.1.2
43
+
44
+ ### Patch Changes
45
+
46
+ - [#78](https://github.com/primer/behaviors/pull/78) [`62e5459`](https://github.com/primer/behaviors/commit/62e545913dae8ca42f88fd6184f190cdf3df9c4c) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Anchored Position: Add alternative alignments to flip to if there isn't enough space
47
+
48
+ ## 1.1.1
49
+
50
+ ### Patch Changes
51
+
52
+ - [#73](https://github.com/primer/behaviors/pull/73) [`a96d60f`](https://github.com/primer/behaviors/commit/a96d60fdb2a2ffdde71a22ea29fa2c788bf4c6aa) Thanks [@dgreif](https://github.com/dgreif)! - Add `import` conditional export type to the package for better NodeJS ESM compatibility
53
+
54
+ ## 1.1.0
55
+
56
+ ### Minor Changes
57
+
58
+ - [#52](https://github.com/primer/behaviors/pull/52) [`1aa3027`](https://github.com/primer/behaviors/commit/1aa302782e3c833f9d9c27f602a046e81f05c3e5) Thanks [@owenniblock](https://github.com/owenniblock)! - Update focusTrap to use new methodology after accessibility discussions
59
+
60
+ ## 1.0.3
61
+
62
+ ### Patch Changes
63
+
64
+ - [#42](https://github.com/primer/behaviors/pull/42) [`41945a3`](https://github.com/primer/behaviors/commit/41945a37ef07da82ce5a29feb03d7a7d96ec76ea) Thanks [@dgreif](https://github.com/dgreif)! - Build both esm and cjs output for the package
65
+
66
+ ## 1.0.2
67
+
68
+ ### Patch Changes
69
+
70
+ - [#17](https://github.com/primer/behaviors/pull/17) [`9194ba4`](https://github.com/primer/behaviors/commit/9194ba403502b4acba0be03bed1a765c1ba81340) Thanks [@dgreif](https://github.com/dgreif)! - Correct margin orientation for `scrollIntoView`
71
+
72
+ * [#18](https://github.com/primer/behaviors/pull/18) [`3b4dd41`](https://github.com/primer/behaviors/commit/3b4dd414175417f83bd144939fe74b2a01bc7136) Thanks [@dgreif](https://github.com/dgreif)! - Export utils as submodule
73
+
74
+ ## 1.0.1
75
+
76
+ ### Patch Changes
77
+
78
+ - [#10](https://github.com/primer/behaviors/pull/10) [`88b6f34`](https://github.com/primer/behaviors/commit/88b6f34bf4874f3c81473020a01a58b197dd6e16) Thanks [@dgreif](https://github.com/dgreif)! - Set up changesets
@@ -245,7 +245,8 @@ function focusZone(container, settings) {
245
245
  }
246
246
  }
247
247
  beginFocusManagement(...(0, iterate_focusable_elements_js_1.iterateFocusableElements)(container));
248
- updateFocusedElement(getFirstFocusableElement());
248
+ const initialElement = typeof focusInStrategy === 'function' ? focusInStrategy(document.body) : getFirstFocusableElement();
249
+ updateFocusedElement(initialElement);
249
250
  const observer = new MutationObserver(mutations => {
250
251
  for (const mutation of mutations) {
251
252
  for (const removedNode of mutation.removedNodes) {
@@ -242,7 +242,8 @@ export function focusZone(container, settings) {
242
242
  }
243
243
  }
244
244
  beginFocusManagement(...iterateFocusableElements(container));
245
- updateFocusedElement(getFirstFocusableElement());
245
+ const initialElement = typeof focusInStrategy === 'function' ? focusInStrategy(document.body) : getFirstFocusableElement();
246
+ updateFocusedElement(initialElement);
246
247
  const observer = new MutationObserver(mutations => {
247
248
  for (const mutation of mutations) {
248
249
  for (const removedNode of mutation.removedNodes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/behaviors",
3
- "version": "1.3.2",
3
+ "version": "1.3.3-rc.be41306",
4
4
  "description": "Shared behaviors for JavaScript components",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",