@atlaskit/react-ufo 4.15.8 → 4.15.9

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.15.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1aacb45a2b77f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1aacb45a2b77f) -
8
+ exclude input name mutations for TTVC v4 due to React/Chromium bug
9
+
3
10
  ## 4.15.8
4
11
 
5
12
  ### Patch Changes
@@ -32,6 +32,11 @@ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
32
32
  if ((0, _platformFeatureFlags.fg)('platform_ufo_enable_media_for_ttvc_v3')) {
33
33
  entryTypes.push('mutation:media');
34
34
  }
35
+
36
+ // Still included as part of TTVC v3
37
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
38
+ entryTypes.push('mutation:attribute:non-visual-input-name');
39
+ }
35
40
  return entryTypes;
36
41
  };
37
42
 
@@ -30,6 +30,9 @@ var getConsideredEntryTypes = function getConsideredEntryTypes() {
30
30
  };
31
31
  var getExcludedEntryTypes = function getExcludedEntryTypes() {
32
32
  var excludedEntryTypes = ['layout-shift:same-rect'];
33
+ if ((0, _platformFeatureFlags.fg)('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
34
+ excludedEntryTypes.push('mutation:attribute:non-visual-input-name');
35
+ }
33
36
  return excludedEntryTypes;
34
37
  };
35
38
 
@@ -23,6 +23,7 @@ var _checkWithinComponent3 = _interopRequireWildcard(require("./utils/check-with
23
23
  var _getMutatedElements = require("./utils/get-mutated-elements");
24
24
  var _isElementVisible = require("./utils/is-element-visible");
25
25
  var _isInVcIgnoreIfNoLayoutShiftMarker = _interopRequireDefault(require("./utils/is-in-vc-ignore-if-no-layout-shift-marker"));
26
+ var _isInputNameMutation = require("./utils/is-input-name-mutation");
26
27
  var _isSameRectDimensions = require("./utils/is-same-rect-dimensions");
27
28
  var _isSameRectSize = require("./utils/is-same-rect-size");
28
29
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
@@ -446,6 +447,21 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
446
447
  }
447
448
  };
448
449
  }
450
+ if ((0, _isInputNameMutation.isInputNameMutation)({
451
+ target: target,
452
+ attributeName: attributeName,
453
+ oldValue: oldValue,
454
+ newValue: newValue
455
+ })) {
456
+ return {
457
+ type: 'mutation:attribute:non-visual-input-name',
458
+ mutationData: {
459
+ attributeName: attributeName,
460
+ oldValue: oldValue,
461
+ newValue: newValue
462
+ }
463
+ };
464
+ }
449
465
  var isRLLPlaceholder = _rllPlaceholders.RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
450
466
  if (isRLLPlaceholder) {
451
467
  return {
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isInputNameMutation = isInputNameMutation;
7
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
+ // Detecting this is required due to a React/Chromium bug, where React itself triggers an attribute mutation for input elements
9
+ // Reference: https://atlassian.slack.com/archives/C08EK6TCUP6/p1764129900970719
10
+ function isInputNameMutation(_ref) {
11
+ var target = _ref.target,
12
+ attributeName = _ref.attributeName,
13
+ oldValue = _ref.oldValue,
14
+ newValue = _ref.newValue;
15
+ if (!(0, _platformFeatureFlags.fg)('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
16
+ return false;
17
+ }
18
+ return target instanceof HTMLInputElement && attributeName === 'name' && (oldValue === '' || newValue === '');
19
+ }
@@ -18,6 +18,11 @@ const getConsideredEntryTypes = include3p => {
18
18
  if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
19
19
  entryTypes.push('mutation:media');
20
20
  }
21
+
22
+ // Still included as part of TTVC v3
23
+ if (fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
24
+ entryTypes.push('mutation:attribute:non-visual-input-name');
25
+ }
21
26
  return entryTypes;
22
27
  };
23
28
 
@@ -15,6 +15,9 @@ const getConsideredEntryTypes = () => {
15
15
  };
16
16
  const getExcludedEntryTypes = () => {
17
17
  const excludedEntryTypes = ['layout-shift:same-rect'];
18
+ if (fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
19
+ excludedEntryTypes.push('mutation:attribute:non-visual-input-name');
20
+ }
18
21
  return excludedEntryTypes;
19
22
  };
20
23
 
@@ -11,6 +11,7 @@ import checkWithinComponent, { cleanupCaches } from './utils/check-within-compon
11
11
  import { getMutatedElements } from './utils/get-mutated-elements';
12
12
  import { isElementVisible } from './utils/is-element-visible';
13
13
  import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
14
+ import { isInputNameMutation } from './utils/is-input-name-mutation';
14
15
  import { isSameRectDimensions } from './utils/is-same-rect-dimensions';
15
16
  import { isSameRectSize } from './utils/is-same-rect-size';
16
17
  const createElementMutationsWatcher = removedNodeRects => ({
@@ -317,6 +318,21 @@ export default class ViewportObserver {
317
318
  }
318
319
  };
319
320
  }
321
+ if (isInputNameMutation({
322
+ target,
323
+ attributeName,
324
+ oldValue,
325
+ newValue
326
+ })) {
327
+ return {
328
+ type: 'mutation:attribute:non-visual-input-name',
329
+ mutationData: {
330
+ attributeName,
331
+ oldValue,
332
+ newValue
333
+ }
334
+ };
335
+ }
320
336
  const isRLLPlaceholder = RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
321
337
  if (isRLLPlaceholder) {
322
338
  return {
@@ -0,0 +1,15 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
+ // Detecting this is required due to a React/Chromium bug, where React itself triggers an attribute mutation for input elements
4
+ // Reference: https://atlassian.slack.com/archives/C08EK6TCUP6/p1764129900970719
5
+ export function isInputNameMutation({
6
+ target,
7
+ attributeName,
8
+ oldValue,
9
+ newValue
10
+ }) {
11
+ if (!fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
12
+ return false;
13
+ }
14
+ return target instanceof HTMLInputElement && attributeName === 'name' && (oldValue === '' || newValue === '');
15
+ }
@@ -25,6 +25,11 @@ var getConsideredEntryTypes = function getConsideredEntryTypes(include3p) {
25
25
  if (fg('platform_ufo_enable_media_for_ttvc_v3')) {
26
26
  entryTypes.push('mutation:media');
27
27
  }
28
+
29
+ // Still included as part of TTVC v3
30
+ if (fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
31
+ entryTypes.push('mutation:attribute:non-visual-input-name');
32
+ }
28
33
  return entryTypes;
29
34
  };
30
35
 
@@ -24,6 +24,9 @@ var getConsideredEntryTypes = function getConsideredEntryTypes() {
24
24
  };
25
25
  var getExcludedEntryTypes = function getExcludedEntryTypes() {
26
26
  var excludedEntryTypes = ['layout-shift:same-rect'];
27
+ if (fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
28
+ excludedEntryTypes.push('mutation:attribute:non-visual-input-name');
29
+ }
27
30
  return excludedEntryTypes;
28
31
  };
29
32
 
@@ -18,6 +18,7 @@ import checkWithinComponent, { cleanupCaches } from './utils/check-within-compon
18
18
  import { getMutatedElements } from './utils/get-mutated-elements';
19
19
  import { isElementVisible } from './utils/is-element-visible';
20
20
  import isInVCIgnoreIfNoLayoutShiftMarker from './utils/is-in-vc-ignore-if-no-layout-shift-marker';
21
+ import { isInputNameMutation } from './utils/is-input-name-mutation';
21
22
  import { isSameRectDimensions } from './utils/is-same-rect-dimensions';
22
23
  import { isSameRectSize } from './utils/is-same-rect-size';
23
24
  var createElementMutationsWatcher = function createElementMutationsWatcher(removedNodeRects) {
@@ -437,6 +438,21 @@ var ViewportObserver = /*#__PURE__*/function () {
437
438
  }
438
439
  };
439
440
  }
441
+ if (isInputNameMutation({
442
+ target: target,
443
+ attributeName: attributeName,
444
+ oldValue: oldValue,
445
+ newValue: newValue
446
+ })) {
447
+ return {
448
+ type: 'mutation:attribute:non-visual-input-name',
449
+ mutationData: {
450
+ attributeName: attributeName,
451
+ oldValue: oldValue,
452
+ newValue: newValue
453
+ }
454
+ };
455
+ }
440
456
  var isRLLPlaceholder = RLLPlaceholderHandlers.getInstance().isRLLPlaceholderHydration(rect);
441
457
  if (isRLLPlaceholder) {
442
458
  return {
@@ -0,0 +1,14 @@
1
+ import { fg } from '@atlaskit/platform-feature-flags';
2
+
3
+ // Detecting this is required due to a React/Chromium bug, where React itself triggers an attribute mutation for input elements
4
+ // Reference: https://atlassian.slack.com/archives/C08EK6TCUP6/p1764129900970719
5
+ export function isInputNameMutation(_ref) {
6
+ var target = _ref.target,
7
+ attributeName = _ref.attributeName,
8
+ oldValue = _ref.oldValue,
9
+ newValue = _ref.newValue;
10
+ if (!fg('platform_ufo_ttvc_v4_exclude_input_name_mutation')) {
11
+ return false;
12
+ }
13
+ return target instanceof HTMLInputElement && attributeName === 'name' && (oldValue === '' || newValue === '');
14
+ }
@@ -1,6 +1,6 @@
1
1
  import type { AbortReasonType, InteractionType } from '../../common/common/types';
2
2
  import type { ObservedWindowEvent } from './window-event-observer';
3
- export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:display-contents-children-element' | 'mutation:display-contents-children-attribute' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute' | 'mutation:media' | 'mutation:rll-placeholder' | 'mutation:third-party-element' | 'mutation:third-party-attribute' | 'mutation:ssr-placeholder' | 'layout-shift' | 'layout-shift:same-rect' | 'window:event' | 'ssr-hydration' | 'unknown';
3
+ export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:display-contents-children-element' | 'mutation:display-contents-children-attribute' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute:non-visual-input-name' | 'mutation:attribute' | 'mutation:media' | 'mutation:rll-placeholder' | 'mutation:third-party-element' | 'mutation:third-party-attribute' | 'mutation:ssr-placeholder' | 'layout-shift' | 'layout-shift:same-rect' | 'window:event' | 'ssr-hydration' | 'unknown';
4
4
  export type ViewportEntryData = {
5
5
  readonly type: VCObserverEntryType;
6
6
  readonly elementName: string;
@@ -0,0 +1,6 @@
1
+ export declare function isInputNameMutation({ target, attributeName, oldValue, newValue, }: {
2
+ target?: Node | null;
3
+ attributeName?: string | null;
4
+ oldValue?: string | undefined | null;
5
+ newValue?: string | undefined | null;
6
+ }): boolean;
@@ -1,6 +1,6 @@
1
1
  import type { AbortReasonType, InteractionType } from '../../common/common/types';
2
2
  import type { ObservedWindowEvent } from './window-event-observer';
3
- export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:display-contents-children-element' | 'mutation:display-contents-children-attribute' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute' | 'mutation:media' | 'mutation:rll-placeholder' | 'mutation:third-party-element' | 'mutation:third-party-attribute' | 'mutation:ssr-placeholder' | 'layout-shift' | 'layout-shift:same-rect' | 'window:event' | 'ssr-hydration' | 'unknown';
3
+ export type VCObserverEntryType = 'mutation:child-element' | 'mutation:remount' | 'mutation:element' | 'mutation:element-replacement' | 'mutation:display-contents-children-element' | 'mutation:display-contents-children-attribute' | 'mutation:attribute:no-layout-shift' | 'mutation:attribute:non-visual-style' | 'mutation:attribute:non-visual-input-name' | 'mutation:attribute' | 'mutation:media' | 'mutation:rll-placeholder' | 'mutation:third-party-element' | 'mutation:third-party-attribute' | 'mutation:ssr-placeholder' | 'layout-shift' | 'layout-shift:same-rect' | 'window:event' | 'ssr-hydration' | 'unknown';
4
4
  export type ViewportEntryData = {
5
5
  readonly type: VCObserverEntryType;
6
6
  readonly elementName: string;
@@ -0,0 +1,6 @@
1
+ export declare function isInputNameMutation({ target, attributeName, oldValue, newValue, }: {
2
+ target?: Node | null;
3
+ attributeName?: string | null;
4
+ oldValue?: string | undefined | null;
5
+ newValue?: string | undefined | null;
6
+ }): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.15.8",
3
+ "version": "4.15.9",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -110,6 +110,9 @@
110
110
  "platform_ufo_critical_metrics_payload": {
111
111
  "type": "boolean"
112
112
  },
113
+ "platform_ufo_ttvc_v4_exclude_input_name_mutation": {
114
+ "type": "boolean"
115
+ },
113
116
  "platform_ufo_disable_vcnext_observations": {
114
117
  "type": "boolean"
115
118
  },