ng-hub-ui-forms 22.33.0 → 22.33.2
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/README.md +17 -0
- package/fesm2022/ng-hub-ui-forms.mjs +10 -2
- package/fesm2022/ng-hub-ui-forms.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -748,6 +748,23 @@ import { HubSignalFieldControl, hubSignalErrorMessages } from 'ng-hub-ui-forms/s
|
|
|
748
748
|
## ♿ Accessibility
|
|
749
749
|
|
|
750
750
|
- Labels are associated with their control (`for`/`id`); required fields are marked.
|
|
751
|
+
- **`labelType="visually-hidden"` names a control that has no room for a visible label.** A
|
|
752
|
+
toolbar search box or a compact grid cell cannot repeat the same word down every row, and the
|
|
753
|
+
alternative was a control with no accessible name at all — a placeholder is not a name. The
|
|
754
|
+
label is still rendered and still bound to the control; only the pixels go, clipped out of the
|
|
755
|
+
page rather than removed with `display: none`, which would take the name with them. Honoured by
|
|
756
|
+
every field, checkboxes and switches included.
|
|
757
|
+
|
|
758
|
+
```html
|
|
759
|
+
<hub-input formControlName="q" label="Search orders" labelType="visually-hidden" placeholder="Search" />
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
A hidden label rather than an `aria-label` on purpose: a label stays *associated* with its
|
|
763
|
+
control, so it is one string in the template that both the eye and the screen reader can be
|
|
764
|
+
given or denied, and it never silently replaces a name the application set for itself. The two
|
|
765
|
+
exceptions are `hub-otp-input` and `hub-segmented`, which render a group rather than a single
|
|
766
|
+
control: a `<label for>` aimed at a `<div>` names nothing, so those two carry the text on the
|
|
767
|
+
group as `aria-label`.
|
|
751
768
|
- `required` — set inline or derived from `Validators.required`, with `formControlName` **or** a direct `[formControl]` binding — is reflected as `aria-required` on every field, including the select's combobox search input, the segmented `radiogroup` and each OTP cell. On a reactive binding the control's validators decide: an inline `required` is overwritten by them, so declare it on the validators. Template-driven bindings (`ngModel`) keep honouring the inline input.
|
|
752
769
|
- Validation errors render in an `role="alert"` region tied to the field.
|
|
753
770
|
- The select exposes correct combobox/listbox semantics; the datepicker is fully keyboard-navigable.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, model, Directive, inject, TemplateRef, InjectionToken, makeEnvironmentProviders, ElementRef, ChangeDetectorRef, contentChild, contentChildren, computed, signal, effect, booleanAttribute, numberAttribute, output, DestroyRef, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, viewChildren, PLATFORM_ID, afterRenderEffect, afterNextRender, Injectable, Renderer2, NgZone, afterEveryRender, HostAttributeToken, linkedSignal, forwardRef, Injector, HostListener, LOCALE_ID, ViewContainerRef, Pipe } from '@angular/core';
|
|
2
|
+
import { input, model, Directive, inject, TemplateRef, InjectionToken, makeEnvironmentProviders, ElementRef, ChangeDetectorRef, contentChild, contentChildren, computed, signal, effect, booleanAttribute, numberAttribute, output, DestroyRef, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, viewChildren, PLATFORM_ID, afterRenderEffect, afterNextRender, Injectable, isDevMode, Renderer2, NgZone, afterEveryRender, HostAttributeToken, linkedSignal, forwardRef, Injector, HostListener, LOCALE_ID, ViewContainerRef, Pipe } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormControlName, FormControlDirective, Validators, FormControl, NgControl, ControlContainer, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
5
|
import { Subject, takeUntil, tap, Observable, animationFrameScheduler, asapScheduler, fromEvent } from 'rxjs';
|
|
@@ -3098,8 +3098,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
3098
3098
|
|
|
3099
3099
|
// @ts-nocheck -- vendored ng-select source (type-checked upstream); see ../PATCHES.md
|
|
3100
3100
|
class ConsoleService {
|
|
3101
|
+
/**
|
|
3102
|
+
* The engine's write-value diagnostics are advice for whoever wrote the form, so they are
|
|
3103
|
+
* kept — a dropped model is worse in silence — but held to development, where that person
|
|
3104
|
+
* is the one reading, and attributed so the message is traceable to this package.
|
|
3105
|
+
*/
|
|
3101
3106
|
warn(message) {
|
|
3102
|
-
|
|
3107
|
+
if (!isDevMode()) {
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
console.warn(`[ng-hub-ui-forms] ${message}`);
|
|
3103
3111
|
}
|
|
3104
3112
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConsoleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3105
3113
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConsoleService, providedIn: 'root' });
|