@fusion.dev/helix-core 0.228.0 → 0.229.0

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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Keeps a failed submit to one message.
3
+ *
4
+ * A control that draws its own feedback under the field also got the browser's
5
+ * bubble over it, so a reader saw the message twice, measured October 31, 2026.
6
+ * Refusing the `invalid` event removes the bubble. It also removes the focus the
7
+ * browser would have moved to the first invalid control, so the first one takes
8
+ * focus here. A fieldset is in `form.elements` and matches `:invalid` when a
9
+ * control inside it does, and it cannot hold focus, so it is passed over.
10
+ */
11
+ export declare const reportInPlace: (control: HTMLElement, event: Event) => void;
@@ -0,0 +1,10 @@
1
+ export const reportInPlace = (control, event) => {
2
+ event.preventDefault();
3
+ const form = control.form;
4
+ const first = form
5
+ ? [...form.elements].find((element) => element.localName !== 'fieldset' && element.matches(':invalid'))
6
+ : control;
7
+ if (first === control && event.isTrusted) {
8
+ control.focus();
9
+ }
10
+ };
@@ -3,6 +3,7 @@ import { html, nothing } from 'lit';
3
3
  import { property, state } from 'lit/decorators.js';
4
4
  import { auditField } from '@fusion.dev/helix-core/audits/name';
5
5
  import { internalsOf } from '../../helix-element/helix-element.js';
6
+ import { reportInPlace } from '../../helix-form-element/report-in-place.js';
6
7
  import { hostAria } from '../../utils/host-aria/host-aria.js';
7
8
  const HINT_ID = 'helix-hint';
8
9
  const FEEDBACK_ID = 'helix-feedback';
@@ -164,9 +165,10 @@ export const MixinField = (Base) => {
164
165
  const touch = () => {
165
166
  this.touched = true;
166
167
  };
167
- this.addEventListener('invalid', () => {
168
+ this.addEventListener('invalid', (event) => {
168
169
  if (!this.checkingValidity) {
169
170
  touch();
171
+ reportInPlace(this, event);
170
172
  }
171
173
  });
172
174
  this.addEventListener('change', touch);
@@ -2,6 +2,7 @@ import { __decorate } from "tslib";
2
2
  import { html, nothing } from 'lit';
3
3
  import { property, state } from 'lit/decorators.js';
4
4
  import { internalsOf } from '../../helix-element/helix-element.js';
5
+ import { reportInPlace } from '../../helix-form-element/report-in-place.js';
5
6
  import { hostAria } from '../../utils/host-aria/host-aria.js';
6
7
  export const MixinPickerFeedback = (Base) => {
7
8
  class PickerFeedbackElement extends Base {
@@ -30,9 +31,10 @@ export const MixinPickerFeedback = (Base) => {
30
31
  const touch = () => {
31
32
  this.touched = true;
32
33
  };
33
- this.addEventListener('invalid', () => {
34
+ this.addEventListener('invalid', (event) => {
34
35
  if (!this.checkingValidity) {
35
36
  touch();
37
+ reportInPlace(this, event);
36
38
  }
37
39
  });
38
40
  this.addEventListener('change', touch);
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * `package.json`, so the two always agree. Nothing else in the running code
6
6
  * knows which release it is.
7
7
  */
8
- export declare const VERSION = "0.228.0";
8
+ export declare const VERSION = "0.229.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.228.0';
1
+ export const VERSION = '0.229.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.228.0",
4
+ "version": "0.229.0",
5
5
  "license": "MIT",
6
6
  "author": "Fusion Development Group",
7
7
  "repository": {
@@ -81,12 +81,12 @@
81
81
  "bugs": "https://github.com/project-fusion/fusion/issues",
82
82
  "dependencies": {
83
83
  "@floating-ui/dom": "^1.8.0",
84
- "@fusion.dev/helix-icons": "0.228.0",
84
+ "@fusion.dev/helix-icons": "0.229.0",
85
85
  "tslib": "^2.8.1"
86
86
  },
87
87
  "devDependencies": {
88
- "@fusion.dev/helix-cem": "0.228.0",
89
- "@fusion.dev/helix-testing": "0.228.0",
88
+ "@fusion.dev/helix-cem": "0.229.0",
89
+ "@fusion.dev/helix-testing": "0.229.0",
90
90
  "@lit-labs/ssr": "^4.1.0",
91
91
  "lit": "^3.2.1"
92
92
  },